Code example for LinkedHashSet

Methods: size, toArray

0
	String[] arrayOne;
 
	@Override 
	public String[] removeDuplicateStrings(String... array) {
		// this.arrayOne = array; 
		HashSet<String> set = new LinkedHashSet<String>(asList(array));
		arrayOne = (String[]) (set.toArray(new String[set.size()]));
		return arrayOne;
	} 
 
	/** 
	 * @param args 
	 */ 
	public static void main(String[] args) {
		String[] array = new String[] { "C", "C", "B", "A", "A", "D", "F", "F",	"G", "A" };
		DuplicateRemoverImpl dri = new DuplicateRemoverImpl();
		System.out.print("before: ");
		dri.printArray(array);
		String[] arrayAfter = dri.removeDuplicateStrings(array);
		System.out.print("\nafter: ");
		dri.printArray(arrayAfter);