This week's book giveaway is in the Artificial Intelligence forum.
We're giving away four copies of Pragmatic AI and have Noah Gift on-line!
See this thread for details.
Win a copy of Pragmatic AI this week in the Artificial Intelligence forum!

Stefano Carniel

Greenhorn
+ Follow
since Aug 01, 2013
Stefano likes ...
Android Java Spring
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
4
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Stefano Carniel

If you can, take a look at this book. It explains very well these concepts, not only, it teaches how to implement classes that support this programming style (methods cascade).
Honestly, what your book states is not in contrast whith what mine states. Functional programming can help to essentially produce safer and more concise code, but for sure this code is less readable (but not necessarily less clean).
11 months ago
Don't know what that book focus on, but functional programming states the opposite. In particular, afaik, with the introduction of the stream (in Java >= 8), it is common practice to call method in "cascade" style.
11 months ago
a suggestion: change the name of your getters and setters to be clearer (getFirstname(), setFirstname(String firstname),...).

then, to print the firstname:


In your code you're applying the indexing to an object of type Employee, which doesn't make sense.

Most elegant solution, for Java >= 8
1 year ago
1 year ago
If you want to have fun too while learning, try codingame. They have a lot of interesting problems (also from algorithmic point of view) and, after you solved, you can see a nice graphical representation
1 year ago
One example that come into my mind is grouping a set of utilities functions that can be invoked frequently and does not require the instantiation of an object. A typical example is the Math class, which includes lot of static functions.
1 year ago
They can be used to store matrix, for example to represent a maze, or a chessboard, but also in lot of mathematical application, to solve linear sytems,...
1 year ago
If I'm not mistaken, BlueJ is an IDE, what's the problem to use it with version 8 of Java?
1 year ago
What about Javafx? It's based on MVC pattern and you have complete separation between views (screens) and logic
1 year ago
If you use Java 8, take a look at the Stream interface. It provides a lot of functions to iterate through the list and reduce results
1 year ago
I read my first post again, well, it is wrong abut the loop upper limit, I explain better my idea in the second post
1 year ago
No, I don't create 10 indexes, I create Array.Size*p/100 indexes (2 if the array has 20 elements). Of course some round checks are required (what if array size = 23?) and of course I have to keep track of the already randomized indexes
1 year ago
If I understand well, this solution allows to modify only consecutive elements of the array. My solution allows to randomize x% of element in random positions
1 year ago
maybe there's something better, but as quick answer, you can do a loop from 0 to percent-1, generate a random index between 0 and the size of array - 1 and change that element with a random 0/1
1 year ago
swapper is working on a copy of the 2 objects, and does not modify the original ones. In java parameters are always passed by value
1 year ago