JAVA   46

ArtComparator

Guest on 11th May 2022 04:32:05 PM

  1. import java.util.*;
  2. import java.text.*;
  3. public class ArtComparator implements Comparator<Djur> {
  4.         Collator co = Collator.getInstance();
  5.  
  6.         public ArtComparator() {
  7.                 co.setStrength(Collator.PRIMARY);
  8.         }//ArtComparator
  9.  
  10.         public int compare(Djur d1, Djur d2) {
  11.                 return d1.visaArt().compareTo(d2.visaArt());
  12.         }//compare
  13. }//Klassen ArtComparator.

Raw Paste


Login or Register to edit or fork this paste. It's free.