Stephan van Hulst

Saloon Keeper
+ Follow
since Sep 20, 2010
Forum Moderator
Stephan van Hulst currently moderates these forums:
Enschede, The Netherlands
Cows and Likes
Cows
Total received
143
In last 30 days
0
Total given
136
Likes
Total received
1621
Received in last 30 days
21
Total given
167
Given in last 30 days
1
Forums and Threads
Scavenger Hunt
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by Stephan van Hulst

The data structure doesn't fulfill the second requirement, the collector does. You can check the Collector.characteristics() method for the CONCURRENT and the UNORDERED characteristics.

Usually you create a stream from a data source yourself, and you already know if the data source has an intrinsic order or not. Lists are ordered. Sets are unordered, except if they're a subtype of SortedSet.
I'm assuming your professor meant static typing.

I concur with him. Maintenance of JavaScript is a hell for me because I never know if a refactor will break anything, unless I completely test the entire codebase. Development tools for statically typed languages are also a lot more powerful.
1 day ago
I used the class City as an example. You have to declare and implement it yourself if you want a strongly typed object, or you can replace all mentions of City with String.
1 day ago
I also wouldn't call them Customer and Address. These classes are obviously intended to represent objects from your business model while they are being transferred somewhere else. I would call such classes CustomerData and AddressData.
4 days ago
Welcome to CodeRanch!

Your pattern only replaces strings that start with a zero width match on the start of the input followed by three commas.

You could write patterns that describe the various elements of your input, and then use a scanner to parse them:

Now you have a strongly typed object of which you can manipulate the members. If you're interested in the cities (or whatever the strings between the names and the times mean) and nothing else, just operate on that field of the object.
4 days ago
Static variables are always a bad thing. Don't use them. Only use static fields for constants.

Keeping connections open has the undesirable consequence that if you create many connections, you may run out and the program may fail.

It's just good practice to get into the habit of using proper connection pools, and disposing your connections as soon as you don't need them any more.
Welcome to CodeRanch!

When you have a problem please explain what the code is supposed to do, what it's doing instead, what errors you're getting, and put the properly formatted code within code tags.
5 days ago
Why are you imposing these restrictions? The only restriction on passwords should be a minimal length.
5 days ago
You need to start by determining what kinds of functions you want to support, and then design classes that represent these functions. You can then write methods that parse functions from an input string.

Start with a design for simple polynomials to get a taste, before you bite off a larger chunk.
6 days ago
You can write web applications without an MVC framework, but that quickly becomes very painful if your web application does more than just respond to a few requests with simple data.

Spring solves many problems that you'll have to solve yourself if you use pure Java. You can't really compare the two, Spring just adds to Java. You'll have to check out the Spring website for all the features they add.
1 week ago
I imagine the author meant something like "don't use a loop of any shape" and didn't proof-read the instructions.
1 week ago
First start by writing some skeleton code for the method signatures that you expect you'll need. Then show us what you got. It doesn't matter that the code doesn't compile, we just want to see how you'd design the outline before you implement it.
1 week ago

Randy Maddocks wrote:Every time I hear, or read, about new viruses out there wreaking havoc on computers I often wonder if the author(s) who wrote the first virus ever regretted it.


I think that if they hadn't written that virus, someone else, later, would have written the first one. People are very good at deliberately breaking things, and if they have the chance to do it without getting caught, they will.
1 week ago
And great quality too! Congratulations!
1 week ago
I believe the problem is caused because registerDog() uses scan.nextDouble() to read a weight, but that statement will block until you've hit enter. After you hit enter, it will read the weight from the line you entered, but the scanner won't proceed past the newline that's still in the input when you hit enter. It processes that newline when reach nextLine() in your loop, which doesn't have any characters preceding it. The solution is to call nextLine() after you've read the age from the input, and call it again after you've read the weight from the input.
1 week ago