1 21 package au.id.jericho.lib.html; 22 23 import java.util.*; 24 25 final class HTMLElementNameSet extends HashSet { 26 public HTMLElementNameSet() { 27 super(1); 28 } 29 30 public HTMLElementNameSet(final String [] items) { 31 super(items.length*2); 32 for (int i=0; i<items.length; i++) add(items[i]); 33 } 34 35 public HTMLElementNameSet(final Collection collection) { 36 super(collection.size()*2); 37 union(collection); 38 } 39 40 public HTMLElementNameSet(final String item) { 41 super(2); 42 add(item); 43 } 44 45 HTMLElementNameSet union(final String item) { 46 add(item); 47 return this; 48 } 49 50 HTMLElementNameSet union(final Collection collection) { 51 for (final Iterator i=collection.iterator(); i.hasNext();) add(i.next()); 52 return this; 53 } 54 55 HTMLElementNameSet minus(final String item) { 56 remove(item); 57 return this; 58 } 59 60 HTMLElementNameSet minus(final Collection collection) { 61 for (final Iterator i=collection.iterator(); i.hasNext();) remove(i.next()); 62 return this; 63 } 64 } 65 | Popular Tags |