First In First Out Comparator

Here is a simple first in first out comparator I recently used.

You can use this to preserve the order of elements getting added to a SortedMap or SortedSet.

public class FIFOComparator implements java.util.Comparator
{

public int compare(Object arg0, Object arg1) {
return 1;
}

}

For more information on Comparators check out this URL – http://www.javaworld.com/javaworld/jw-12-2002/jw-1227-sort.html

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: