Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
org.apache.commons.collections4.list.TreeList Example
What is org.apache.commons.collections4.list.TreeList class? How to use org.apache.commons.collections4.list.TreeList class?
✍: FYIcenter.com
org.apache.commons.collections4.list.TreeList class is a Java class
offered in commons-collections4.jar that
implements the java.util.List interface using
a tree structure internally for fast insertions and removals at any index in the list
Here is a simple example of using org.apache.commons.collections4.list.TreeList class:
// Copyright (c) 2016-2018 FYIcenter.com
// Supports commons-collections4-4.2
// Supports commons-collections4-4.1
import java.util.List;
import org.apache.commons.collections4.list.TreeList;
// Example of using the TreeListExample class
public class TreeListExample {
public static void main(String[] args) throws Exception {
// Create some objects
String apple = "Apple";
String orange = "Orange";
String banana = "Banana";
// Create a TreeList list
List<String> list = new TreeList<String>();
// insert objects into the list from the beginning position
list.add(0, apple);
list.add(0, orange);
list.add(0, apple);
list.add(0, orange);
list.add(0, apple);
list.add(0, banana);
// loop through the set as a list
for (int i=0; i<list.size(); i++) {
String obj = list.get(i);
System.out.println(i+": " + obj);
}
}
}
You can compile and run the above example in a command window as shown below:
C:\fyicenter>\fyicenter\jdk-1.8.0\bin\javac -cp C:\fyicenter\commons-collections4-4.2\commons-collections4-4.2.jar TreeListExample.java C:\fyicenter>\fyicenter\jdk-1.8.0\bin\java -cp .;C:\fyicenter\commons-collections4-4.2\commons-collections4-4.2.jar TreeListExample 0: Banana 1: Apple 2: Orange 3: Apple 4: Orange 5: Apple
⇒ FAQ for Apache commons-collections.jar
⇐ org.apache.commons.collections4.set.ListOrderedSet Example
2017-05-20, ∼3101🔥, 0💬
Popular Posts:
maven-model-builder-3.8. 6.jaris the JAR file for Apache Maven 3.8.6 Model Builder module. Apache Ma...
maven-core-3.8.6.jar is the JAR file for Apache Maven 3.8.6 Core module. Apache Maven is a software ...
io.jar is a component in iText Java library to provide input/output functionalities. iText Java libr...
What Is ojdbc8.jar for Oracle 12c R2? ojdbc8.jar for Oracle 12c R2 is the JAR files of ojdbc.jar, JD...
JDK 11 jdk.charsets.jmod is the JMOD file for JDK 11 Charsets module. JDK 11 Charsets module compile...