java:jfc_intf_set

This is an old revision of the document!


A PCRE internal error occured. This might be caused by a faulty plugin

====== Set ====== Το //Set// είναι ένα Collection το οποίο δεν επιτρέπει διπλές εγγραφές. Δείτε το παρακάτω παράδειγμα κώδικα <code java FindDups2.java> public class FindDups2 { public static void main(String[] args) { Set<String> uniques = new HashSet<String>(); Set<String> dups = new HashSet<String>(); for (String a : args) if (!uniques.add(a)) dups.add(a); // Destructive set-difference uniques.removeAll(dups); System.out.println("Unique words: " + uniques); System.out.println("Duplicate words: " + dups); } } </code>

java/jfc_intf_set.1426525226.txt.gz · Last modified: 2016/02/26 11:15 (external edit)