All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.spun.util.MultiSorter Maven / Gradle / Ivy

There is a newer version: 24.9.0
Show newest version
package com.spun.util;

import java.util.Comparator;

public class MultiSorter implements java.util.Comparator
{
  private Comparator[] comparators = null;
  public MultiSorter(Comparator... comparators)
  {
    this.comparators = comparators;
  }
  public int compare(T o1, T o2)
  {
    for (Comparator comp : comparators)
    {
      int value = comp.compare(o1, o2);
      if (value != 0)
      { return value; }
    }
    return 0;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy