Take a look at LinkedHashSet class
Hash table and linked list implementation of the Set interface, with predictable iteration order. This implementation differs from HashSet in that it maintains a doubly-linked list running through all of its entries. This linked list defines the iteration ordering, which is the order in which elements were inserted into the set (insertion-order). Note that insertion order is not affected if an element is re-inserted into the set. (An element e is reinserted into a set s if s.add(e) is invoked when s.contains(e) would return true immediately prior to the invocation.).
Related Posts:
- Any implementation of Ordered Set in Java?
- What are the differences between a HashMap and a Hashtable in Java?
- Java Ordered Map
- HashSet vs. ArrayList
- Easiest way to convert a List to a Set in Java
- How to sort a HashSet?
- Union or intersection of Java Sets
- How to use Collections.sort() in Java?
- When to use LinkedList over ArrayList in Java?
- Difference between Arrays.asList(array) and new ArrayList
(Arrays.asList(array)) - Initialization of an ArrayList in one line
- How to sort an ArrayList?
- Convert Set to List without creating new List
- Difference between HashSet and HashMap?
- C# Set collection?
- Why is there no SortedList in Java?
- How to convert List
to int[] in Java? - Printing HashMap In Java
- How to convert int[] into List
in Java? - java, get set methods
- How do I efficiently iterate over each entry in a Java Map?
- FIFO based Queue implementations?
- Create a List of primitive int?
- How to convert int[] to Integer[] in Java?
- Change priorityQueue to max priorityqueue
- Collections.emptyMap() vs new HashMap()
- Sort a Map
by values - Most efficient way to increment a Map value in Java
- How to calculate the intersection of two sets?
- Why is a ConcurrentModificationException thrown and how to debug it
- What’s the difference between HashSet and Set?
- Fastest way to put contents of Set
to a single String with words separated by a whitespace? - What does Java option -Xmx stand for? [duplicate]
- Finding white rectangle in an image
- How to use the toString method in Java?
- Unable to find valid certification path to requested target – error even after cert imported
- javac is not recognized as an internal or external command, operable program or batch file [closed]
- Change date format in a Java string
- Converting String to “Character” array in Java
- Java – What does “\n” mean? [duplicate]
- must declare a named package eclipse because this compilation unit is associated to the named module
- string to string array conversion in java
- C# Java HashMap equivalent
- Compiled vs. Interpreted Languages
- How to round up to the next integer?
- Spring @PropertySources value not overriding
- Array ArrayList python equivalent
- extends class and implements interface in java
- Java ArrayList copy
- Getting java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory exception
- Explain the use of a bit vector for determining if all characters are unique
- What does the following Oracle error mean: invalid column index
- Sorting HashMap by values
- Maven: Failed to read artifact descriptor
- The system cannot find the file specified in java
- What does
(angle brackets) mean in Java? - Java Generate Random Number Between Two Given Values
- Causes of getting a java.lang.VerifyError
- ConcurrentHashMap and Hashtable in Java
- “Unmappable character for encoding UTF-8” error
- UnsatisfiedDependencyException: Error creating bean with name
- Random shuffling of an array
- Why am I getting a “; expected” error?
- How to create a directory in Java?
- Converting from Integer, to BigInteger
- Error:java: javacTask: source release 8 requires target release 1.8
- Get a resource using getResource()
- Java comparing generic types
- Simplest way to read JSON from a URL in Java
- Display Animated GIF
- Float and double datatype in Java
- How to open a new tab using Selenium WebDriver in Java?
- Selenium Webdriver: Element Not Visible Exception
- Whitespace Matching Regex – Java
- What are mock objects in Java?
- java array error “array required but int found”
- Unreachable code in eclipse
- this: Cannot use this in static context
- “Field can be converted to a local variable” message appearing when setting Android ActionBar colour
- Convert an integer to an array of digits
- Google firebase check if child exists
- Can we execute a java program without a main() method? [duplicate]
- How to really read text file from classpath in Java
- Java command not found on Linux
- Selenium using Java – The path to the driver executable must be set by the webdriver.gecko.driver system property
- How to break out or exit a method in Java?
- Java Exception in thread “AWT-EventQueue-0” java.lang.NullPointerException
- Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/JDBC_DBO]]
- How can we prepend strings with StringBuilder?
- How to get the filename without the extension in Java?
- Java using enum with switch statement
- Removing double quotes from a string in Java
- Iterative Fibonacci code in Java?
- What is inverse function to XOR?
- Java Swing revalidate() vs repaint()
- Append a single character to a string or char array in java?
- for each loop in groovy
- Details of difference between @see and @inheritDoc
- add string to String array
- Difference between System.getProperty(“line.separator”); and “\n”?