Templates by BIGtheme NET

Data Structures

Best way of Find Frequency of Objects in Collection

Description: This will help to understands Iterables.frequency() method. This method will returns int that frequency of the given object in particular list. The comparision, whethet the objects are equals or not with the help of equals method of Entity class bank. import java.util.ArrayList; import java.util.List; import com.google.common.collect.Iterables; public class FindFrequencyOfOneJavaObjectInCollection { public static void main(String[] args) { Bank sbi = ...

Read More »

Fastest way of Convertion One Java Object To Another

Description: Most of the time we need to convert one java object to another java object. To do this job, one of the best way by using com.google.common.collect.Iterables Class, we can achieve the task. Converting One Entity to another Entity. Example 1: How list of Bank object are converted to list bank names. import java.util.ArrayList; import java.util.List; import com.google.common.base.Function; import ...

Read More »

Java Collections – Sorting Problem

One of my hot favorite topic is sorting. Description of the problem: 1) Imagine a line of containers which are going to be loaded onto the ship. Assume the desired loading sequence is 1,2,3 eg C1 C2 C3 C4 C5 C6 2) A Container class is has a sequence method .getSeq(). So lets say for C1, container.getSeq() == 1 For ...

Read More »