Skip to content

Java 8(Lambdas and Streams) and collections usage with custom entities

Notifications You must be signed in to change notification settings

shivamaggarwal7/Java-Basics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java-Basics

Java 8(Lambdas and Streams) and Collections

• A TreeSet uses compareTo(Object o) method implementation from Comparable interface to check for both duplicate elements as well as for sorting.

• A HashSet uses hashCode() and equals(Object o) method to check for duplicates

• From Java 8 onwards,Streams provide an efficient way to iterate over collections and for large data sets,parallel streams can be used for processing collections.

• For using a custom entity with collections,it is best practice to:

 1)Override hashCode() and equals(Object o) methods
 
 2)Implement Comparable<T> interface,providing implementation for compareTo(Object  o) method

• For further info,please refer to document resource

https://github.com/shivamaggarwal7/Java-Basics/tree/master/resources

About

Java 8(Lambdas and Streams) and collections usage with custom entities

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages