private static boolean areAttachmentLabelsUnique(List<String> labels) {
    Map<String, String> map = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
    for (int i = 0; i < labels.size(); i++) {
      map.put(labels.get(i), labels.get(i));
    }
    if (labels.size() == map.size()) {
      return true;
    } else {
      return false;
    }
  }
private static boolean areAttachmentLabelsUnique ( List < String > labels ) { Map < String , String > map = new TreeMap < String , String > ( String . CASE_INSENSITIVE_ORDER ) ; for ( int i = 0 ; i < labels . size ( ) ; i ++ ) { map . put ( labels . get ( i ) , labels . get ( i ) ) ; } if ( labels . size ( ) == map . size ( ) ) { return true ; } else { return false ; } }
This method checks if strings in a list are unique

@param labels list of attachments labels
@return true or false