What is new and interesting in JDK 7?


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?