Java Data structure

Source: Internet
Author: User
Tags bitset

The data structures provided by the Java Toolkit are very powerful and perform a variety of functions. These data structures include the following interfaces and classes:

    • Enumeration

    • BitSet

    • Vector

    • Stack

    • Dictionary

    • Hashtable

    • Properties

All of these classes are now traditional and Java-2 introduces a new framework called the collection framework, which will be discussed in the following tutorial:

Enumeration:

The enumeration interface itself is not a data structure, but it is very important in other data structures. The enumeration interface defines a means of retrieving successive elements of a data structure.

For example, an enumeration defines a method named Nextelement that is used to get the next element in a data structure that contains more than one element.

BitSet

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

This class is useful in situations where you need to keep up with a set of Boolean values, assigning only one bit to each value, and setting or clearing the appropriate.

Vector-vectors

The vector class is similar to a traditional Java array, but it can grow as needed to accommodate the new elements.

Elements like arrays of a vector object can be accessed by indexing into a vector.

The advantage of using the vector class is that it does not have to worry about setting a specific size when it is created, it will grow automatically when needed.

For more detailed information about this class, see the Vector

Stack-Stacks

The Stack class implements the last-in-first-out (LIFO) stack of elements.

The vertical stack of the Chimney object can be literally thought of, and when a new element is added, it will be stacked on top of others.

When pulling an element out of the stack, it falls off from the top. In other words, the last element that is added to the stack is the first one out.

Dictionary-Dictionary

The dictionary class is an abstract class that defines a data structure that maps the value of a key.

This is useful in situations where you want to be able to access data through a specific key, rather than an integer index.

The dictionary class is abstract, and it provides only a framework for a key-mapped data structure, rather than a specific implementation.

Hashtable

The Hashtable class provides a way for organizations to customize key structure data based on some users.

For example, in a hash table of address lists, you can store and sort data based on a key, such as a postal code, rather than a person's name.

The specific meaning of the key about the hash table is completely dependent on the use of the hash table and the data it contains.

Properties

property is a subclass of a hash table. It is used to maintain a list of values, where the key is a string, and the value is also a string.

The properties class is made up of many other Java classes. For example, it is returned by an object that gets the value type of the environment through System.getproperties ().

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.