Richard Reese

author
+ Follow
since Jul 13, 2011
Richard likes ...
Eclipse IDE Firefox Browser Java
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
5
In last 30 days
0
Total given
0
Likes
Total received
6
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Richard Reese

From a historical programming perspective, I remember the concepts being introduced in the following order:

Functional, Structured, OOP, AOP

Functional programming has been around since at least Lisp (1957) with structured programming coming into existence in the 1960s. OOP, as a term, started with Smalltalk in the 1970's though the concept existed in different forms well before then. AOP appear rather recently. These approaches are based on concepts that predate them making it hard to provide a definitive order.
9 years ago
Harsha,

There is nothing explicit in java 8 that I am aware of that simplifies swing or web application development. JavaFX 8 has been released and it is able to take advantage of Java 8 features.

9 years ago
Duncan,

The addition of new features to Java 8 does not encourage using non-OO techniques. For example, lambda expressions complement OO programming. They are based on anonymous inner classes.

Most of the new Java 8 features are tied to lambda expressions one way or another. Pai’s recommendation is a good one since the Date API is not as dependent on lambda expressions.

With regards to Java enhancements since Java 1.5, I don’t believe they are adding features just to add features. They are driven by Java community recommendations and other language developments. Of course developments like LINQ impact Java’s direction.

9 years ago
Pradeep,

The addition of default methods is a controversial one for many. Time will tell, however, I feel they are a good addition. I don’t have much insight into the developer’s rationale. Maurice Naftalin’s comments are a good starting point for further information about this topic: http://www.lambdafaq.org/what-are-default-methods/.

9 years ago
Pradeep,

There are new flags added for Metaspace in JDK 8. Check out the following article for more details on how to manage this space: https://blogs.oracle.com/poonam/entry/about_g1_garbage_collector_permanent. There still may be some problems with native memory, but there are options to handle it.

9 years ago
Bret,

I think Java is definitely changing but it’s like most languages in that it doesn’t necessarily force you to use specific techniques. For example, you can write a non-object oriented program in C++ and still call it C++. The new Java provides you with more options to solve problems. Whether you use them is another story.

I think the answer to your question is that it all depends on who uses it and their ability and motivation for using new features. The new version of Java simply gives you many more new options than it had before.
9 years ago
Sean,

I wouldn’t expect existing libraries to be rewritten using the Optional class. It can be used to create better libraries in the future. One of the nice things about using the Optional class is that it will force you to deal with null values. You will have to actively consider the possibility that a null result may be encounter. This will make your code more stable. Of course this comes with a cost: more time spent developing your code. The payback is arguably better code.

9 years ago
Jeanne,

You are correct. It should be getYear() and not getDayOfYear(). This will be added to the book’s errata.

For better or worse I used a more verbose approach to calculate the current date to illustrate the methods available. LocalDate.now() is shorter and can be used. Knowing about these methods allows you to easily calculate a future date where one of the “of” methods parameter is modified. Similar results can be obtained using a “plus” method.

The new data and time API provides a lot of flexibility in how temporal values can be created. At the same time, this flexibility can be confusing as to which method is best.
9 years ago
Karina,
Lambdas are quite flexible. They can be passed multiple parameters and return values. Arguments types can be implied in many situations and lambda bodies can be multiple lines. Your concern about “how c gets fed” is a good one. This is one of those neat things that the compiler does for you. It is able to infer the data type and then “get” the values based on the lambda expressions’ context. Lambda expressions do not contain information about which functional interface it is implementing. It all depends on the context in which it is being used.

9 years ago
Rick,

In addition to Campbell’s response, there have been a number of enhancements to the VM that makes for a better VM including removal of three infrequently used garbage collection routines and permanent generation. Many of these improvements are not normally of interest to many programmers. Another interesting addition is the introduction of compact profiles which can help reduce the size of your application.

9 years ago
Carlos,

The book is not aimed at beginner Java programmers. There are other books out there better suited for that. Once he has mastered the basic concepts of Java, then this book will help him get up to speed on Java 8.

9 years ago
Saleem,

There can be but you need to be careful. Streams can be processed either sequentially or concurrently. On small streams, processing them concurrently may take more time than doing them sequentially. You also want to make sure that a stream processed concurrently does not introduce errors. This can occur when there are “sequential” dependencies that can affect the results.

With that said, streams can result in better performance. Better yet, they are easier to build and understand than using more traditional manual multiple threading approaches.
9 years ago
Krystian,

Yes. The book assumes that you understand the basics of Java which it sounds like you have. It will provide you with a good overview of what is available in Java 8. One thing that I do different from other Java 8 books is that I spend more time with default methods and functional interfaces. Most of everything else flows from these features. Once you have mastered them, then the other concepts fall into place more easily.


9 years ago