Sorting List by using Comparator Interface In this article, I am going to explain the Sorting List by using Comparator Interface. Objects Type List can be sorted by using a Comparator interface. By using comparator we can sort the list of objects by a single field or multiple fields either in ascending order or descending […]
Tag: sort list
How to Sort a List By Using Comparable Interface
How to Sort a List By Using Comparable Interface In this article, going to explain How to Sort a List By Using Comparable Interface. Wrapper Class type List can be sorted by using the Collection.sort() method but the List type is Object then we have to use comparable interface to sort. Example Create VO Class […]
How to sort a List in java
How to sort a List in java In this article, explaining how to sort a list in java. We can sort list which contains Primitive data types or Wrapper Class Types by using Collections.sort(list) or list.stream().forEach(); We can’t sort list which contains object data types so that we have to use a comparator or comparable […]