What is new and interesting in JDK 7?

I wanted to document the most interesting features of JDK 7 here, for my own gratification and to make a place where you can contribute your great finds:

  • Invokedynamic bytecode for doing runtime binding of callsites
  • Named regular expression groups
  • Try with resources / AutoCloseable
  • MethodHandles
  • BufferPoolMXBean — where did all my memory go?
  • SocketOption, ProtocolFamily and NetworkInterface
  • Async IO — including filesystem notifications and a new network stack
  • ForkJoinPool
  • TransferQueue
  • Precise exception rethrowing, catching more than one exception type
  • Switch on String
  • Much better GZIP support
  • Global logger and other log management stuff
  • ThreadLocalRandom
  • Bitset.valueOf() for arrays
  • Paths for manipulating file paths
  • Files for copying files and streams, etc. Swiss army knife of stuff
  • File attributes, ACLs, etc.
  • Long.compare — probably caused a lot of bugs
  • Tons of Locale / Character updates

Things I found that are old but new to me:

  • Scanner – using all regexes, probably horribly inefficient
  • PriorityQueue, Deque
  • Atomic*FieldUpdaters

Am I missing anything?

This entry was posted in Technology. Bookmark the permalink.
  • Arul Dhesiaseelan

    There are few other improvements in Java 7 worth mentioning:
    – Improved Type Inference for Generic Instance Creation aka Diamond (ex: List people = new ArrayList;)
    – Binary literals and underscores in literals (ex: int phoneNumber = 123_456_7890;)
    – Simplified Varargs Method Invocation (@SafeVarargs)
    – ReflectiveOperationException (Common superclass of exceptions thrown by reflective operations in
    core reflection.)
    – File system WatchService

  • http://twitter.com/cstivers78 Chris Stivers

    I like the less boilerplate in type inferences and catch statement:

    try {
    Vector v = new Vector();
    } catch ( AException | BException ex ) {

    … almost as good as scala :)

    I also like the addition of SCTP and RDMA (via SDP) to the networking stack. Both will provide interesting new network appliances/applications.

  • http://twitter.com/cstivers78 Chris Stivers

    BTW, I posted earlier, then edited it and it disappeared. Not sure what happened.

  • http://twitter.com/sampullara Sam Pullara

    Weird. Using disqus so don’t have a lot of control over that.

  • Ashwin Jayaprakash

    Phasers – http://javaforu.blogspot.com/2011/08/java-7s-jucphaser-short-tutorial.html .. although it reads like an obscure/esoteric data structure.

    I’d stay away from MethodHandles for now. They’re still slower than Reflection (!). Java 8 may be better.

  • kaili

    If you happen to celebrate with multiple hunters make sure that each of you knows where Sting to use. Each Hunter can have a Sting active at a time. If you have two fighters, it’s been two bites that can be on the monster. Ask your companion Hunter to throw a Sting while you start the other. diablo 3 gold Hunters have to fight one another if the monster attacks one of them, the other Hunter can still draw from the range. Hunters are great to deal with monsters who fled. The Hunter can shoot arcane during the race shot. It can also use Mark Hunter, while on the run.If you need to hunt a monster player or an enemy as they fled, keep this in mind. If you are attacked by a player when you are not ready to fight them, d3 gold you can shoot them with the arrow of dispersion, and turn on Aspect of the Cheetah to run away. Make sure that your pet is in passive or to follow so that it won’t interrupt the arrow of dispersion. You can also do this against monsters if an additional attack Monster.