Slashdot Mirror


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.

12 of 427 comments (clear)

  1. Re:Java? by Anonymous Coward · · Score: 0, Insightful

    Agreed. Not the best choice for anything.

  2. System.exit() by oddware · · Score: 2, Insightful

    It's the best thing java can do

  3. Promoted? by bengoerz · · Score: 4, Insightful

    This user's entire submission history consists of 2 stories about Java within an hour of each other. Smells like shill.

  4. New and exciting ways to run out of heap space by Anonymous Coward · · Score: 2, Insightful

    No more permgen!

  5. Re:Could you gush a little more? by RobotRunAmok · · Score: 4, Insightful

    No, it's not journalism. It's another in Infoworld's tedious astro-turf-by-story-submission stories. They pay Slashdot, have one of their Marketing Chippies put together a story with a link back to their trade mag, and the skids are greased for it to hit the main page here as scheduled. (snydeq is their usual flunky) The incredible -- or just-precious -- part of it is that InfoWorld believes there is enough of any critical mass of programmers or software industry decision-makers who still frequent Slashdot to make this a worthwhile media buy for them.

  6. Re:Java? by 0100010001010011 · · Score: 4, Insightful

    Tools are tools. People need to quit arguing over how a tool was made and just use them.

    I use Jenkins daily, it's written in Java. It's great. I have no desire to ever learn Java but it doesn't mean I can't use Jenkins. I have tools written in JavaScript, C, C++, Matlab, Simulink, Python, Perl, PHP, et al. As long as I have a way of getting it fixed if it's broken I don't care.

    Additionally there's good money to be made in supporting tools that everyone still uses. COBOL, Fortran, Assembly all still have a massive amount of technical debt that may never go away.

  7. Re:So what would you use? by Dutch+Gun · · Score: 4, Insightful

    Unless you like staying up all night tracking down errors in pointer arithmetic.

    Lumping C and C++ together generally means you haven't looked at how dramatically the C++ language has changed recently, especially if you talk about pointer arithmetic. If you're using modern C++ and are still worrying about pointer arithmetic (i.e. you're not abstracting it away), you're probably doing it wrong.

    The nice thing about C++ is that, quite often, those abstractions either cost nothing at all, or at worst, far less than interpreted languages. Also, having used modern C++ for a few years now, I think garbage collection is vastly overrated compared to reference counted pointers and simple RAII. C++ is still harder to use than Java or C# in many subtle ways, but basic memory management is no longer one of those persistent thorns.

    Efficient compilation? Yeah, sadly, that's not C++, and likely never will be. There are some newer alternatives that have these features and compile quite efficiency, since they don't come with the baggage of backwards compatibility, but I'm not sure how much traction they're going to gain in practical measurements outside of some niche locations. Their biggest downside? Yeah, they're not backwards compatible with billions of lines of C or C++ code out in the wild.

    --
    Irony: Agile development has too much intertia to be abandoned now.
  8. Re: Row row row your boat by AuMatar · · Score: 4, Insightful

    Exactly the opposite. Streams took easy to read and understand for loops used by every language on earth and replaced it with gibberish that you need to work through to understand, and is far more difficult top debug as there's no damn place to put a break point or print statement. They're banned everywhere I've heard of

    --
    I still have more fans than freaks. WTF is wrong with you people?
  9. Re: Major features are complementary by AuMatar · · Score: 3, Insightful

    If you think that mess of streams is clearer than a for loop would be, you're on crack. It's incomprehensible.

    --
    I still have more fans than freaks. WTF is wrong with you people?
  10. Re:Major features are complementary by The+Evil+Atheist · · Score: 4, Insightful

    How about... read the fucking documentation? I'm a C++ guy and always lamented the fact that Java did not have an algorithms equivalent. Java 8 streams + lambdas are almost there and you can achieve complex things without nested loops.

    Stop conflating your unfamiliarity with it being shit. It took me, a C++ guy, a day of getting used to it. If you can't wrap your head around that, you shouldn't be programming. It's easy stuff.

    --
    Those who do not learn from commit history are doomed to regress it.
  11. Re:Major features are complementary by abies · · Score: 3, Insightful

    Yes, it looks like garbage, this is why some people are switching to java dialects (still fully compatible with all libraries and java APIs both directions, but considerably shorter). My favorite, xtend, would have

    def getLastFour(Optional employee) {
        employee.flatMap(primaryAddress) .flatMap(zipCode) .flatMap(lastFour) .orElseThrow[new FMLException("Missing data")];
    }

    or, without Optionals and exceptions, old school, embrace nulls

    def getLastFour(Employee employee) {
        employee?.primaryAddress?.zipCode?.lastFour
    }

    You can get similarly short code in groovy, scala, koitlin and whatever else. Java strength lies in ecosystem (frameworks, interoperability, portability etc), not because of language syntax.

    Said that, there is a lot of overdesign and monstrosities in popular frameworks as well, but there you have a choice of using something more lightweight.

  12. Re: Row row row your boat by AuMatar · · Score: 3, Insightful

    No,you're going to rewrite it to a for loop because its more maintainable, more easy to change with changing requirements, and more understandable.

    --
    I still have more fans than freaks. WTF is wrong with you people?