- The new java.util.Objects class provides some nice static convenience methods as described in my blog post JDK 7: The New Objects Class.
- Three new convenience methods have been added to the already useful Collections class: Collections.emptyIterator(), Collections.emptyListIterator(), and Collections.emptyEnumeration().
- New static methods for comparing primitives [similar to the already existing Double.compare(double,double) and Float.compare(float,float)] are now available for additional numeric/boolean types: Byte.compare(byte, byte), Integer.compare(int,int), Long.compare(long,long), Short.compare(short,short), and Boolean.compare(boolean,boolean).
- Calendar gets some Java 7 attention (even if it's not the overhaul many of us had hoped for): Calendar.isWeekDateSupported(), Calendar.getWeekYear(), Calendar.setWeekDate(int,int,int), and Calendar.getWeeksInWeekYear(). The TimeZone.observesDaylightTime() method has also been added. The implementation of this interface that most of us use, GregorianCalendar, has these methods implemented now.
- There are several changes related to Java reflection:
- The java.lang.reflect.Modifier class has new static methods: classModifiers(), interfaceModifiers(), constructorModifiers(), methodModifiers(), and fieldModifiers().
- I have written a more detailed blog post on the new ReflectionOperationException class.
- ConcurrentLinkedDeque and LinkedTransferQueue are now available.
- The java.util.ConcurrentModificationException has two new constructors that each accept a cause and one of them accepts a detailed message as well.
- The java.net.ProtocolFamily interface is new as is the enum StandardProtocolFamily that implements this interface.
- The class InetAddress has a new method called getLoopbackAddress(). The method InetAddress.isLoopbackAddress() has been available since JDK 1.4.
- ProcessBuilder gets a new nested class called Redirect, which itself contains a nested Type enum.
- The Character class now contains a nested UnicodeScript enum.
- BitSet.valueOf(long[])
- Multiple JDBC enhancements:
- The Statement interface prescribes two new methods: closeOnCompletion() and isCloseOnCompletion().
- The java.sql.DatabaseMetaData interface has two new methods: getPseudoColumns() and generatedKeyAlwaysReturned().
- JDBC's CallableStatement gets two new overloaded getObject() methods that get an object based on provided name or index along with the expected object's class type.
- The Driver class got a new method Driver.getParentLogger() that returns a java.util.logging.Logger. CommonDataSource gets the same new method.
- File.toPath() provides a java.nio.file.Path.
- There are several new classes and interfaces related to security:
- The new java.security.AlgorithmConstraints interface "specifies constraints for cryptographic algorithms, keys (key sizes), and other algorithm parameters."
- The new CertificateRevokedException "indicates an X.509 certificate is revoked."
- CertPathValidatorException got a new constructor that accepts an implementation of the new nested CertPathValidatorException.Reason interface as a parameter and there is a method to get this reason. The new CertPathValidatorException.BasicReason enum implements the CertPathValidatorException.Reason interface and "enumerates the potential reasons that a certification path of any type may be invalid."
- The new invokedynamic feature requires new support:
- The new java.dyn.InvokeDynamicBootstrapError is thrown "to indicate that an invokedynamic instruction" has had some sort of problem (not found or other problem). The MethodHandle class and related functionality are further described in A glimpse at MethodHandle and its usage.
- There is a new reflection exception called WrongMethodTypeException.
- Two new methods have been added to Throwable to support the new try-with-resources feature: addSuppressed(Throwable) and getSuppressed(). Because both Exception and Error extend
Throwable
, all exceptions and errors can support providing the suppressed exceptions as appropriate. - AssertionError has a new constructor accepting a cause.
- Numerous Swing/AWT-related changes.
- Numerous NIO-related changes (NIO.2).
- Applet even gets something in Java 7: Applet.isValidateRoot().
- New JMX features include the PlatformManagedObject interface and the ManagementFactory.getAllPlatformMXBeanInterfaces() method, both of which I discussed in my blog post JDK 7 JMX Platform Management Beans: A First Peek.
- There are numerous new concurrency support constructs coming to JDK 7 above and beyond some I highlighted above.
- The Locale class documentation mentions "1.7" sixteen times! The 1.7 changes to the class are called out in the class's main description. One significant method is toLanguageTag() that provides "a well-formed IETF BCP 47 language tag representing this locale." The static method forLanguageTag(String) provides an instance of Locale corresponding to the provided String representing the "specified IETF BCP 47 language tag." The very extensive documentation for this method points out an important caveat: "there is no guarantee that toLanguageTag and forLanguageTag will round-trip." The Java Tutorials' Creating a Locale is already updated to reflect using Java 7 features of this class. Among other things, it highlights the new nested Locale.Builder class and the new nested Locale.Category enum.
All of the above are representative of changes coming to the Java SDK with Java SE 7. However, there are numerous additional changes. The Javadoc seems to have been updated fairly well to indicate "Since: 1.7" for features new to JDK 7. One way to "search" for new Java 7 features would be to download the source code and search it for "1.7." Another approach would be to search the generated Javadoc for the same string.
The following Groovy script provides a brute force mechanism for searching the online JDK 7 Javadoc API documentation for methods, classes, enums, methods, and interfaces that contain the string "1.7." I threw this together quickly and believe there are several more elegant ways to do this, but this was easy to write and does the job.
The above Groovy script searches the Javadoc documentation for "1.7" and provides a list of Javadoc files for classes, enums, interfaces, and methods that include the "1.7" string. According to the script's output, 4020 files were searched and 304 of those files contained at least once occurrence of the "1.7" string.
The following Javadoc HTML files were identified by the script as containing the string "1.7" somewhere within the page's documentation. With the exception of a few possible cases in which "1.7" is used for something else, it can be assumed that these are classes, interfaces, and enums that have been marked "Since 1.7."
javax/lang/model/util/AbstractAnnotationValueVisitor7.html
javax/lang/model/util/AbstractElementVisitor7.html
java/util/concurrent/locks/AbstractQueuedLongSynchronizer.html
java/util/concurrent/locks/AbstractQueuedSynchronizer.html
javax/lang/model/util/AbstractTypeVisitor6.html
javax/lang/model/util/AbstractTypeVisitor7.html
java/nio/channels/AcceptPendingException.html
java/nio/file/AccessDeniedException.html
java/nio/file/AccessMode.html
java/nio/file/attribute/AclEntry.html
java/nio/file/attribute/AclEntry.Builder.html
java/nio/file/attribute/AclEntryFlag.html
java/nio/file/attribute/AclEntryPermission.html
java/nio/file/attribute/AclEntryType.html
java/nio/file/attribute/AclFileAttributeView.html
java/security/AlgorithmConstraints.html
java/nio/channels/AlreadyBoundException.html
java/applet/Applet.html
java/lang/AssertionError.html
java/nio/channels/AsynchronousByteChannel.html
java/nio/channels/AsynchronousChannel.html
java/nio/channels/AsynchronousChannelGroup.html
java/nio/channels/spi/AsynchronousChannelProvider.html
java/nio/channels/AsynchronousFileChannel.html
java/nio/channels/AsynchronousServerSocketChannel.html
java/nio/channels/AsynchronousSocketChannel.html
java/nio/file/AtomicMoveNotSupportedException.html
java/nio/file/attribute/AttributeView.html
javax/sound/sampled/AudioFormat.Encoding.html
java/lang/AutoCloseable.html
javax/swing/plaf/basic/BasicColorChooserUI.html
javax/swing/plaf/basic/BasicComboBoxUI.html
java/nio/file/attribute/BasicFileAttributes.html
java/nio/file/attribute/BasicFileAttributeView.html
javax/swing/plaf/basic/BasicFileChooserUI.html
javax/swing/plaf/basic/BasicMenuItemUI.html
javax/swing/plaf/basic/BasicScrollBarUI.html
javax/swing/plaf/basic/BasicTreeUI.html
java/util/BitSet.html
java/lang/Boolean.html
javax/swing/BorderFactory.html
java/nio/BufferPoolMXBean.html
java/lang/Byte.html
java/util/Calendar.html
java/sql/CallableStatement.html
java/security/cert/CertificateRevokedException.html
java/security/cert/CertPathValidatorException.html
java/security/cert/CertPathValidatorException.BasicReason.html
java/security/cert/CertPathValidatorException.Reason.html
java/nio/channels/Channels.html
java/lang/Character.html
java/lang/Character.UnicodeBlock.html
java/lang/Character.UnicodeScript.html
java/lang/ClassLoader.html
java/nio/file/ClosedDirectoryStreamException.html
java/util/Collections.html
javax/sql/CommonDataSource.html
java/nio/channels/CompletionHandler.html
java/util/concurrent/ConcurrentLinkedDeque.html
java/util/ConcurrentModificationException.html
java/sql/Connection.html
java/awt/Container.html
java/nio/file/CopyOption.html
java/security/cert/CRLReason.html
java/security/CryptoPrimitive.html
java/util/Currency.html
java/util/spi/CurrencyNameProvider.html
java/awt/Cursor.html
java/sql/DatabaseMetaData.html
java/nio/channels/DatagramChannel.html
javax/swing/text/DefaultStyledDocument.html
javax/swing/tree/DefaultTreeCellRenderer.html
javax/swing/tree/DefaultTreeSelectionModel.html
java/util/zip/Deflater.html
java/util/zip/DeflaterOutputStream.html
javax/print/attribute/standard/DialogTypeSelection.html
java/nio/file/DirectoryIteratorException.html
java/nio/file/DirectoryNotEmptyException.html
java/nio/file/DirectoryStream.html
java/nio/file/DirectoryStream.Filter.html
javax/lang/model/type/DisjunctiveType.html
java/nio/file/attribute/DosFileAttributes.html
java/nio/file/attribute/DosFileAttributeView.html
java/sql/Driver.html
javax/lang/model/element/ElementKind.html
javax/lang/model/util/ElementKindVisitor6.html
javax/lang/model/util/ElementKindVisitor7.html
javax/lang/model/util/ElementScanner7.html
java/awt/EventQueue.html
java/beans/Expression.html
javax/net/ssl/ExtendedSSLSession.html
java/security/cert/Extension.html
java/beans/FeatureDescriptor.html
java/io/File.html
java/nio/file/FileAlreadyExistsException.html
java/nio/file/attribute/FileAttribute.html
java/nio/file/attribute/FileAttributeView.html
java/nio/channels/FileChannel.html
javax/swing/plaf/FileChooserUI.html
java/awt/FileDialog.html
java/nio/channels/FileLock.html
java/nio/file/attribute/FileOwnerAttributeView.html
java/nio/file/Files.html
java/nio/file/FileStore.html
java/nio/file/attribute/FileStoreAttributeView.html
java/nio/file/FileSystem.html
java/nio/file/FileSystemException.html
java/nio/file/FileSystemLoopException.html
java/nio/file/spi/FileSystemProvider.html
java/nio/file/FileSystems.html
java/nio/file/attribute/FileTime.html
java/nio/file/spi/FileTypeDetector.html
java/nio/file/FileVisitOption.html
java/nio/file/FileVisitor.html
java/nio/file/FileVisitResult.html
java/util/concurrent/ForkJoinPool.html
java/util/concurrent/ForkJoinTask.html
java/util/concurrent/ForkJoinWorkerThread.html
java/awt/GraphicsConfiguration.html
java/awt/GraphicsDevice.html
java/awt/GraphicsDevice.WindowTranslucency.html
java/util/GregorianCalendar.html
java/nio/file/attribute/GroupPrincipal.html
java/util/zip/GZIPOutputStream.html
javax/swing/text/html/HTMLFrameHyperlinkEvent.html
java/net/HttpURLConnection.html
javax/swing/event/HyperlinkEvent.html
java/nio/channels/IllegalChannelGroupException.html
java/util/IllformedLocaleException.html
java/net/InetAddress.html
java/net/InetSocketAddress.html
java/lang/Integer.html
java/nio/channels/InterruptedByTimeoutException.html
java/beans/Introspector.html
java/awt/event/InvocationEvent.html
java/dyn/InvokeDynamicBootstrapError.html
javax/swing/JLayer.html
javax/swing/JList.html
javax/swing/JSlider.html
javax/swing/text/JTextComponent.html
javax/swing/JTree.EmptySelectionModel.html
java/awt/event/KeyEvent.html
javax/swing/plaf/LayerUI.html
java/lang/LinkageError.html
java/util/concurrent/LinkedTransferQueue.html
java/nio/file/LinkOption.html
java/nio/file/LinkPermission.html
java/util/Locale.html
java/util/Locale.Builder.html
java/util/Locale.Category.html
java/util/spi/LocaleNameProvider.html
java/util/logging/Logger.html
java/lang/Long.html
java/lang/management/ManagementFactory.html
java/nio/channels/MembershipKey.html
javax/sound/midi/MetaMessage.html
javax/sound/midi/MidiDeviceReceiver.html
javax/sound/midi/MidiDeviceTransmitter.html
java/lang/reflect/Modifier.html
java/awt/event/MouseWheelEvent.html
java/nio/channels/MulticastChannel.html
java/nio/channels/NetworkChannel.html
java/net/NetworkInterface.html
javax/swing/plaf/nimbus/NimbusLookAndFeel.html
java/nio/file/NoSuchFileException.html
java/nio/file/NotDirectoryException.html
java/nio/file/NotLinkException.html
java/awt/font/NumericShaper.html
java/awt/font/NumericShaper.Range.html
java/util/Objects.html
java/nio/file/OpenOption.html
javax/lang/model/element/Parameterizable.html
java/nio/file/Path.html
java/nio/file/PathMatcher.html
java/nio/file/Paths.html
java/util/concurrent/Phaser.html
java/security/cert/PKIXReason.html
java/util/logging/PlatformLoggingMXBean.html
java/lang/management/PlatformManagedObject.html
java/nio/file/attribute/PosixFileAttributes.html
java/nio/file/attribute/PosixFileAttributeView.html
java/nio/file/attribute/PosixFilePermission.html
java/nio/file/attribute/PosixFilePermissions.html
java/lang/ProcessBuilder.html
java/lang/ProcessBuilder.Redirect.html
java/beans/PropertyChangeEvent.html
java/net/ProtocolFamily.html
java/sql/PseudoColumnUsage.html
javax/lang/model/element/QualifiedNameable.html
java/nio/channels/ReadPendingException.html
java/util/concurrent/RecursiveAction.html
java/util/concurrent/RecursiveTask.html
java/lang/ReflectiveOperationException.html
java/sql/ResultSet.html
javax/sql/rowset/RowSetFactory.html
javax/sql/rowset/RowSetProvider.html
java/util/Scanner.html
java/util/concurrent/ScheduledThreadPoolExecutor.html
java/awt/SecondaryLoop.html
java/nio/file/SecureDirectoryStream.html
java/nio/channels/SeekableByteChannel.html
java/nio/channels/spi/SelectorProvider.html
java/nio/channels/ServerSocketChannel.html
java/lang/Short.html
javax/sound/midi/ShortMessage.html
java/nio/channels/ShutdownChannelGroupException.html
javax/lang/model/util/SimpleAnnotationValueVisitor7.html
javax/lang/model/util/SimpleElementVisitor7.html
java/nio/file/SimpleFileVisitor.html
java/util/SimpleTimeZone.html
javax/lang/model/util/SimpleTypeVisitor7.html
java/nio/channels/SocketChannel.html
java/net/SocketOption.html
javax/lang/model/SourceVersion.html
javax/net/ssl/SSLEngine.html
javax/net/ssl/SSLParameters.html
javax/rmi/ssl/SslRMIServerSocketFactory.html
javax/net/ssl/SSLServerSocket.html
javax/net/ssl/SSLSocket.html
java/nio/file/StandardCopyOption.html
java/nio/file/StandardOpenOption.html
java/net/StandardProtocolFamily.html
java/net/StandardSocketOption.html
java/nio/file/StandardWatchEventKind.html
java/sql/Statement.html
javax/swing/border/StrokeBorder.html
javax/swing/SwingUtilities.html
javax/swing/plaf/synth/SynthButtonUI.html
javax/swing/plaf/synth/SynthCheckBoxMenuItemUI.html
javax/swing/plaf/synth/SynthCheckBoxUI.html
javax/swing/plaf/synth/SynthColorChooserUI.html
javax/swing/plaf/synth/SynthComboBoxUI.html
javax/swing/plaf/synth/SynthDesktopIconUI.html
javax/swing/plaf/synth/SynthDesktopPaneUI.html
javax/swing/plaf/synth/SynthEditorPaneUI.html
javax/swing/plaf/synth/SynthFormattedTextFieldUI.html
javax/swing/plaf/synth/SynthInternalFrameUI.html
javax/swing/plaf/synth/SynthLabelUI.html
javax/swing/plaf/synth/SynthListUI.html
javax/swing/plaf/synth/SynthLookAndFeel.html
javax/swing/plaf/synth/SynthMenuBarUI.html
javax/swing/plaf/synth/SynthMenuItemUI.html
javax/swing/plaf/synth/SynthMenuUI.html
javax/swing/plaf/synth/SynthOptionPaneUI.html
javax/swing/plaf/synth/SynthPanelUI.html
javax/swing/plaf/synth/SynthPasswordFieldUI.html
javax/swing/plaf/synth/SynthPopupMenuUI.html
javax/swing/plaf/synth/SynthProgressBarUI.html
javax/swing/plaf/synth/SynthRadioButtonMenuItemUI.html
javax/swing/plaf/synth/SynthRadioButtonUI.html
javax/swing/plaf/synth/SynthRootPaneUI.html
javax/swing/plaf/synth/SynthScrollBarUI.html
javax/swing/plaf/synth/SynthScrollPaneUI.html
javax/swing/plaf/synth/SynthSeparatorUI.html
javax/swing/plaf/synth/SynthSliderUI.html
javax/swing/plaf/synth/SynthSpinnerUI.html
javax/swing/plaf/synth/SynthSplitPaneUI.html
javax/swing/plaf/synth/SynthTabbedPaneUI.html
javax/swing/plaf/synth/SynthTableHeaderUI.html
javax/swing/plaf/synth/SynthTableUI.html
javax/swing/plaf/synth/SynthTextAreaUI.html
javax/swing/plaf/synth/SynthTextFieldUI.html
javax/swing/plaf/synth/SynthTextPaneUI.html
javax/swing/plaf/synth/SynthToggleButtonUI.html
javax/swing/plaf/synth/SynthToolBarUI.html
javax/swing/plaf/synth/SynthToolTipUI.html
javax/swing/plaf/synth/SynthTreeUI.html
javax/swing/plaf/synth/SynthUI.html
javax/swing/plaf/synth/SynthViewportUI.html
javax/sound/midi/SysexMessage.html
java/util/concurrent/ThreadLocalRandom.html
java/lang/Throwable.html
java/util/TimeZone.html
java/awt/Toolkit.html
java/util/concurrent/TransferQueue.html
java/beans/Transient.html
javax/lang/model/type/TypeKind.html
javax/lang/model/util/TypeKindVisitor7.html
javax/lang/model/util/Types.html
javax/lang/model/type/TypeVisitor.html
javax/lang/model/UnknownEntityException.html
java/net/URLClassLoader.html
java/nio/file/attribute/UserDefinedFileAttributeView.html
java/nio/file/attribute/UserPrincipal.html
java/nio/file/attribute/UserPrincipalLookupService.html
java/nio/file/attribute/UserPrincipalNotFoundException.html
java/nio/file/Watchable.html
java/nio/file/WatchEvent.html
java/nio/file/WatchEvent.Kind.html
java/nio/file/WatchEvent.Modifier.html
java/nio/file/WatchKey.html
java/nio/file/WatchService.html
java/awt/Window.html
java/awt/Window.Type.html
java/nio/channels/WritePendingException.html
java/dyn/WrongMethodTypeException.html
java/security/cert/X509CertSelector.html
java/security/cert/X509CRLEntry.html
javax/net/ssl/X509ExtendedTrustManager.html
java/beans/XMLDecoder.html
java/beans/XMLEncoder.html
java/util/zip/ZipFile.html
java/util/zip/ZipInputStream.html
java/util/zip/ZipOutputStream.html
Not everything new to JDK 7 is properly labeled with "1.7" in its Javadoc documentation (many new constructs in java.lang.dyn do not have "1.7" in their documentation, for example). However, the list above is probably fairly close to the set of files with changes significant enough to be identified in the documentation.
Conclusion
The changes to JDK 7 APIs range from specific (reflection, concurrency, client, JMX) to general (new Objects class) and range in degree to which they will impact the typical Java developer. The list above helps provide an idea of what types of changes an individual Java developer might look forward to with JDK 7.