Category "java-8"

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