Slashdot Asks: What Are Your Favorite Java 8 Features? (infoworld.com)
New submitter liveedu shares with us a report from InfoWorld: When Java 8 was released two years ago, the community graciously accepted it, seeing it as a huge step toward making Java better. Its unique selling point is the attention paid to every aspect of the programming language, including JVM (Java Virtual Machine), the compiler, and other help-system improvements. Java is one of the most searched programming languages according to TIOBE index for July 2016, where Java ranks number one. Its popularity is also seen on LiveCoding, a social live coding platform for engineers around the world, where hundreds and thousands of Java projects are broadcasted live. InfoWorld highlights five Java 8 features for developers in their report: lambda expressions, JavaScript Nashorn, date/time APIs, Stream API and concurrent accumulators. But those features only scratch the surface. What makes Java 8 amazing in your opinion? What are your favorite Java 8 features that help you write high quality code? You can view the entire list of changes made to the programming language here.
The biggest news in Java 8, obviously, are lambdas, but they also fit together with functional interfaces and java.util.stream.Stream to really change the way you build stuff in Java.
I'm absolutely loving, after making use of Java 8 streams, just how clean, succinct and compact a lot of my new code has become.
Oh -- and yes -- Java now has monads:
public String getLastFour(Optional employee) {
return employee.flatMap(employee -> employee.getPrimaryAddress())
}
See here
(Now if only they borrowed a bit more heavily from Scala or even C#: stuff like a Try monad, tuples and tuple destructuring and proper pattern matching (like C# is getting) would be awesome. Although given the glacial pace of standardization in Java-land, I'm not holding my breath.)
Looks like you're looking for "JSR 354: Money and Currency API" Its an API, not language primitive. Its not surprising given that decimal numbers are essentially strings for all tense and purposes with some convenience math features wrapped around them. Outside of said library there are probably dozens of math libs that you could work with for your fixed size precision needs.
Bye!
Agreed. Not the best choice for anything.
Bullocks.. There are places for using Java.. Lots of them actually...
Now, I'm not going to blow the fan boy smoke and say Java is great for everything, it's not. I've seen applications in Java that where wholly inappropriate for the language, but because that's what the development team knew, that's what we got, with horrible results, performance and foot print problems that would make your head spin. (It made mine spin, trying to keep up with the ever expanding hardware requirements to keep that garbage running.)
So what's Java good for? User interfaces (GUI, WEB you name it) it's great. Need it OS independent? Use Java. It's OK for data processing, but you will need lots of compute resources compared to the same thing in C++. Don't like the "hard work" involved in memory management, Use Java and restart often. However, if you have strict response time budgets, or cannot afford to cycle processes to keep running, and lots of extra hardware use something else... PLEASE use something else because I know I won't field those kinds of applications in Java for you, I've had enough pain in my life already and I'm going to quit your project if you try to make me do it again...
"File to fit, pound to insert, paint to match" - Aircraft Maintenance 101
I mean, it's awesome that security fixes are now separate from feature changes and that they are so easy to install and track! I love being able to so easily manage a single runtime with no compatibility issues on my clients now too. Oracle has saved java!
Be Excellent To Each Other
BigDecimal is not a work-around. It is the exact solution to the problem.
Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
Well, I'm both a programmer and a decision maker, and I really wonder about the motivation of someone who would pick Java for a new project. Oracle is beyond toxic.
I'm a certified Java Programmer (1.4) and really don't advertise it any more. Oracle's Java is dead to me.