Java Data structure

Source: Internet
Author: User
Tags bit set bitset

Java Data Structures Java contains a powerful structure, in Java contains the following types of interfaces and classes
枚举(Enumeration)位集合(BitSet)向量(Vector)栈(Stack)字典(Dictionary)哈希表(Hashtable)属性(Properties)

Enumeration (enumeration)

The enumeration (enumeration) interface, although not part of the data structure itself, is widely used in other data structure categories. The enumeration (the enumeration) interface defines a way to retrieve contiguous elements from a data structure.

For example, an enumeration defines a method called Nextelement, which is used to get the next element of a data structure that contains multiple elements.

For more information about enumerating interfaces, see enumerations (enumeration).
Bit set (BitSet)

A bit collection class implements a set of bits or flags that can be set and cleared individually.

This class is useful when dealing with a set of Boolean values, and you can manipulate Boolean values by assigning a "bit" to each value and then setting or clearing the bits appropriately.

Vectors (vector)

Vector classes are very similar to traditional arrays, but the size of vectors can change dynamically as needed.

As well as arrays, the elements of a vector object can also be accessed through an index.

The main advantage of using the vector class is that you don't have to specify the size of the object when you create it, and its size changes dynamically as needed.
Stacks (Stack)

Stack implements a last-in-first-out (LIFO) data structure.

You can understand the stack as a vertically distributed stack of objects, and when you add a new element, place the new element at the top of the other element.

When you take an element from the stack, you take an element from the top of the stack. In other words, the last element of the stack is first taken out.

Dictionary (Dictionary)

The dictionary (Dictionary) class is an abstract class that defines the data structure in which keys are mapped to values.

You should use dictionary when you want to access data through a specific key rather than an integer index.

Because the dictionary class is an abstract class, it only provides a data structure where the key is mapped to a value, without providing a specific implementation:
Hash table (Hashtable)

The Hashtable class provides a means of organizing data on the basis of a user-defined key structure.

For example, in a hash table of address lists, you can store and sort data based on postal codes as keys, rather than through names.

The exact meaning of the hash table key depends entirely on the usage scenario of the hash table and the data it contains.

Attributes (properties)

Properties inherited from the Hashtable.properties class represents a persistent set of properties. Each key and its corresponding value in the attribute list is a string.

The Properties class is used by many Java classes. For example, when you get an environment variable it acts as the return value of the System.getproperties () method.

Java Data structure

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.