/** * Adds all of the elements in the specified collection to this collection * * @param c the collection to add */ @Override public boolean addAll(Collection<? extends String> c) { boolean result; Iterator<? extends String> iter; result = false; iter = c.iterator(); while (iter.hasNext()) { result = add(iter.next()) || result; } return result; }
/** * Adds all of the elements in the specified collection to this collection * * @param c the collection to add */ @Override public boolean addAll(Collection<? extends String> c) { boolean result; Iterator<? extends String> iter; result = false; iter = c.iterator(); while (iter.hasNext()) { result = add(iter.next()) || result; } return result; }
/** * Only for testing (prints the built Trie). Arguments are added to the Trie. * If not arguments provided then a few default strings are uses for building. * * @param args commandline arguments */ public static void main(String[] args) { String[] data; if (args.length == 0) { data = new String[3]; data[0] = "this is a test"; data[1] = "this is another test"; data[2] = "and something else"; } else { data = args.clone(); } // build trie Trie t = new Trie(); for (String element : data) { t.add(element); } System.out.println(t); } }
/** * Only for testing (prints the built Trie). Arguments are added to the Trie. * If not arguments provided then a few default strings are uses for building. * * @param args commandline arguments */ public static void main(String[] args) { String[] data; if (args.length == 0) { data = new String[3]; data[0] = "this is a test"; data[1] = "this is another test"; data[2] = "and something else"; } else { data = args.clone(); } // build trie Trie t = new Trie(); for (String element : data) { t.add(element); } System.out.println(t); } }
/** * builds a new trie from the given data and returns it * * @param data the data to use for initializing the Trie * @return the built Trie */ public Trie buildTrie(String[] data) { Trie result; int i; result = new Trie(); for (i = 0; i < data.length; i++) result.add(data[i]); return result; }
/** * builds a new trie from the given data and returns it * * @param data the data to use for initializing the Trie * @return the built Trie */ public Trie buildTrie(String[] data) { Trie result; int i; result = new Trie(); for (i = 0; i < data.length; i++) result.add(data[i]); return result; }