background preloader


Facebook Twitter

Java 101: The essential Java language features tour, Part 7. End your tour of Java's essential language features with Jeff's introduction to Java 8's method references, interface default and static methods, and three lesser known language updates that every Java developer should know about.

Java 101: The essential Java language features tour, Part 7

You'll also preview some interesting additions coming up in Java 9. The Essential Java language features tour has explored the most popular and commonly used features introduced with every version of Java since JDK 1.4. With this article we come to the end of the journey -- at least for now. Lambdas and functional interfaces are two of the best-known features added to Java 8, and I covered them in Part 6. In this article we'll get to know Java 8's contributed method references, interface default and static methods, as well as type annotations, repeating annotations, and improvements to generic type inference. Download. Lesson: Generics (Updated) (The Java™ Tutorials > Learning the Java Language) In any nontrivial software project, bugs are simply a fact of life.

Lesson: Generics (Updated) (The Java™ Tutorials > Learning the Java Language)

Careful planning, programming, and testing can help reduce their pervasiveness, but somehow, somewhere, they'll always find a way to creep into your code. This becomes especially apparent as new features are introduced and your code base grows in size and complexity. Fortunately, some bugs are easier to detect than others. Compile-time bugs, for example, can be detected early on; you can use the compiler's error messages to figure out what the problem is and fix it, right then and there. Runtime bugs, however, can be much more problematic; they don't always surface immediately, and when they do, it may be at a point in the program that is far removed from the actual cause of the problem. (Java Platform SE 8 ) Classes to support functional-style operations on streams of elements, such as map-reduce transformations on collections. (Java Platform SE 8 )

For example: int sum = .filter(b -> b.getColor() == RED) .mapToInt(b -> b.getWeight()) .sum(); Here we use widgets, a Collection<Widget>, as a source for a stream, and then perform a filter-map-reduce on the stream to obtain the sum of the weights of the red widgets. (Summation is an example of a reduction operation.) The key abstraction introduced in this package is stream. Lesson: Basic I/O (The Java™ Tutorials > Essential Classes) This lesson covers the Java platform classes used for basic I/O.

Lesson: Basic I/O (The Java™ Tutorials > Essential Classes)

It first focuses on I/O Streams, a powerful concept that greatly simplifies I/O operations. The lesson also looks at serialization, which lets a program write whole objects out to streams and read them back again. Then the lesson looks at file I/O and file system operations, including random access files. Why Build Your Java Projects with Gradle Rather than Ant or Maven? For years, builds had the simple requirements of compiling and packaging software.

Why Build Your Java Projects with Gradle Rather than Ant or Maven?

But the landscape of modern software development has changed, and so have the needs for build automation. Today, projects involve large and diverse software stacks, incorporate multiple programming languages, and apply a broad spectrum of testing strategies. With the rise of agile practices, builds must support early integration of code as well as frequent and easy delivery to both test and production environments. Established build tools regularly fall short in meeting these goals. How many times have your eyes glazed over while looking at XML to figure out how a build works? Gradle is the next evolutionary step in JVM-based build tools. Java 8: Lambdas & Java Collections. Lambdas are the main theme of Java 8 and this is a very cool, and long-awaited, addition to Java platform.

Java 8: Lambdas & Java Collections

However, lambdas alone would have been worthless if we didn’t have any means for applying lambdas to collections. The problem of migrating the interfaces to be able to use lambdas in collections is solved with default methods which are also referred as defender methods. In this blog post we will take a dive into bulk data operations for Java collections.

Bulk operations – what’s in it? As the original change spec says, the purpose of bulk operations is to “add functionality to the Java Collections Framework for bulk operations upon data. […] Operations upon data are generally expressed as lambda functions”. Internal vs External Interation Historically, Java collections were not capable to express internal iteration as the only way to describe iteration flow was the for (or while) loop. The internal iteration isn’t that much related to bulk operations over collections. Stream API Map. Sean cassidy : Better Java. Java is one of the most popular programming languages around, but no one seems to enjoy using it.

sean cassidy : Better Java

Lesson: Introducing MBeans (The Java™ Tutorials > Java Management Extensions (JMX)) This lesson introduces the fundamental concept of the JMX API, namely managed beans, or MBeans.

Lesson: Introducing MBeans (The Java™ Tutorials > Java Management Extensions (JMX))

An MBean is a managed Java object, similar to a JavaBeans component, that follows the design patterns set forth in the JMX specification. An MBean can represent a device, an application, or any resource that needs to be managed. MBeans expose a management interface that consists of the following: A set of readable or writable attributes, or both.A set of invokable operations.A self-description. The management interface does not change throughout the life of an MBean instance.

The JMX specification defines five types of MBean: Standard MBeansDynamic MBeansOpen MBeansModel MBeansMXBeans The examples in this trail demonstrate only the simplest types of MBean, namely standard MBeans and MXBeans. Java 8 Stream Tutorial - Benjamin Winterberg. This example-driven tutorial gives an in-depth overview about Java 8 streams.

Java 8 Stream Tutorial - Benjamin Winterberg

When I first read about the Stream API, I was confused about the name since it sounds similar to InputStream and OutputStream from Java I/O.