private static Collection<TrustAnchor> sortPotentialAnchors(Set<TrustAnchor> anchors){
  if (anchors.size() <= 1) {
    return anchors;
  }
  List<TrustAnchor> sortedAnchors=new ArrayList<TrustAnchor>(anchors);
  Collections.sort(sortedAnchors,TRUST_ANCHOR_COMPARATOR);
  return sortedAnchors;
}

private static Collection < TrustAnchor > sortPotentialAnchors ( Set < TrustAnchor > anchors ) { if ( anchors . size ( ) <= 1 ) { return anchors ; } List < TrustAnchor > sortedAnchors = new ArrayList < TrustAnchor > ( anchors ) ; Collections . sort ( sortedAnchors , TRUST_ANCHOR_COMPARATOR ) ; return sortedAnchors ; }
sort potential anchors so that the most preferred for use come first .
