Category "java-8"

JavaFX: ObsevableMap keySet as an ObservableSet

I want to transform an ObservableMap's keySet to a read only ObservableSet. I don't want to copy the value, any modification to the ObservableMap must affect th

Why does persist(StorageLevel.MEMORY_AND_DISK) give different results than cache() with HBase?

I could sound naive asking this question but this is a problem that I have recently faced in my project. Need some better understanding on it. df.persist(Stora

How to do this string pattern aaabbc to be displayed as 3a2b1c in java 8 using streams

I want to display the String pattern aaabbcc to be displayed as 3a2b2c in java8 using streams I have a working example in lower versions String str = "aabbcccdd

How do I use the new computeIfAbsent function?

I very much want to use Map.computeIfAbsent but it has been too long since lambdas in undergrad. Almost directly from the docs: it gives an example of the ol

Merge Map<String, List<String> Java 8 Stream

I would like to merge two Map with JAVA 8 Stream: Map<String, List<String>> mapGlobal = new HashMap<String, List<String>>(); Map<Str

Removing Java 8 JDK from Mac

So I installed the beta of JDK 8 a while ago to look at some of the examples. I thought for sure by now, it's easy to change between versions. Doing some Play

Oracle DB connections not releasing from connection pool in Tomcat 8

We are migrating Tomcat6, java 6 and Oracle 10g web-applications to Tomcat 8, Java 8 and Oracle 10g. Our applications working fine after migrated, but initial c

Do lambda expressions have any use other than saving lines of code?

Do lambda expressions have any use other than saving lines of code? Are there any special features provided by lambdas which solved problems which weren't easy

How to find the tag Value in the dynamic JSON-Object with Java 8

I have JSON-object which has a dynamic key inside it. I need to get a specific value mapped to this dynamic Key. For example: value "10.00" will be returned for

Java 8 Stream - .max() with duplicates

So I have a collection of objects that have a step variable that can be 1 - 4. public class MyClass { private Long step; //other variables, getters, s

How to check if exists any duplicate in Java 8 Streams?

In java 8, what's the best way to check if a List contains any duplicate? My idea was something like: list.size() != list.stream().distinct().count() Is it

Type Mismatch cannot convert from type Optional<User> to User

I am trying to create a website that allows the user to update, edit, delete, etc., and I have got to the part of Updating or Editing user’s information.

Serialize Java 8 Stream with Jersey

How can I serialize a Java 8 java.util.Stream<T> with Jersey. I tried to write a MessageBodyWriter, but I need to know how to compose (decorate) existing

Why cant I make an enum's inner class public?

Testing some things out I tried o make an enum in which every one element in a enum have a different class inside. Take for example: public enum MyEnum { f

How to compare the elements of an ArrayList with every element of another ArrayList using Stream API of Java 8?

I have two Sorted ArrayList of same size, namely team_A & team_B, in which comparing every element of team_A with team_B to find the powerDiff > 0. After