/* Copyright 2005, 2005 The Apache Software Foundation or its licensors, as applicable
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *     http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package java.util;


import java.io.Serializable;

/**
 * LinkedHashSet
 * 
 */
public class LinkedHashSet extends HashSet implements Set, Cloneable,
		Serializable {
	
	/**
	 * Contructs a new empty instance of LinkedHashSet.
	 */
	public LinkedHashSet() {
		super(new LinkedHashMap());
	}

	/**
	 * Constructs a new instance of LinkedHashSet with the specified capacity.
	 * 
	 * @param capacity
	 *            the initial capacity of this HashSet
	 */
	public LinkedHashSet(int capacity) {
		super(new LinkedHashMap(capacity));
	}

	/**
	 * Constructs a new instance of LinkedHashSet with the specified capacity
	 * and load factor.
	 * 
	 * @param capacity
	 *            the initial capacity
	 * @param loadFactor
	 *            the initial load factor
	 */
	public LinkedHashSet(int capacity, float loadFactor) {
		super(new LinkedHashMap(capacity, loadFactor));
	}

	/**
	 * Constructs a new instance of LinkedHashSet containing the unique elements
	 * in the specified collection.
	 * 
	 * @param collection
	 *            the collection of elements to add
	 */
	public LinkedHashSet(Collection collection) {
		super(new LinkedHashMap(collection.size() < 6 ? 11
				: collection.size() * 2));
		Iterator it = collection.iterator();
		while (it.hasNext())
			add(it.next());
	}

	/* overrides method in HashMap */
	HashMap createBackingMap(int capacity, float loadFactor) {
		return new LinkedHashMap(capacity, loadFactor);
	}
}

@@ -738,21 +738,423 @@
 dHashSet
-%0D%0A * 
+ is a variant on HashSet. Its entries are kept in a doubly-linked list.%0D%0A * The iteration order is the order in which entries were inserted.%0D%0A * %3Cp%3E%0D%0A * Null elements are allowed, and all the optional Set operations are supported.%0D%0A * %3Cp%3E%0D%0A * Like HashSet, LinkedHashSet is not thread safe, so access by multiple threads must be synchronized%0D%0A * by an external mechanism such as Collections.synchronizedSet.
 %0D%0A */%0D%0Ap
@@ -1245,11 +1245,83 @@
  %7B%0D%0A
-
 %09%0D%0A
+%09private static final long serialVersionUID = -2851667679971038690L;%0D%0A%0D%0A
 %09/**

Fix for HARMONY-77 (serialVersionUID is missed in java.util.LinkedHashSet)