Java Collection, java Collection class details
Collection
Collection is an interface that allows a set to contain duplicate elements or prohibit repeated elements. You can force or limit the order. The following describes some common basic methods in Collection.
1
Collection learning notes and collection learning notes
BinarySearch principle:
Public static index halfSearch (List
{
Int max, min, mid; Max = list. size ()-1; Min = 0; While (min { Mid = (max + min)> 1; String str = list. get (mid ); Int num = str. compareTo (key ); If (num> 0) Max = mid-1; Else if (num Min = min + 1; Return min; // if it is Collections. binarySearch (), it is the location afte
1. The Java Collection Framework provides a set of well-performing, easy-to-use interfaces and classes that are located in the Java.util packageAttention:
There are both interfaces and classes, the picture of the solid line is the class, the dotted line is the interface
Need to import Java.util package before use
List and set are sub-interfaces of collection, ArrayList and LinkedList are two impleme
Collection caseStore strings and TraverseStore custom objects and traverseStudent (Name,age)importjava.util.Collection;importjava.util.Iterator;/** Requirements: Store strings and traverse them. ** Analysis: *a: Creating a Collection Object *b: Creating a String Object * c: Adding a String object to the collection *d: Iterating through the
Recently, collection has been a hot topic, from news thieves to music thieves to news collection and flash collection. Many people are interested in collection, to serve everyone, I am also writing a collection set
Program The name is the intention
Roughly divided into set,list,queue,map four kinds of systemSet represents unordered, non-repeatable collections, accessed through the element itselfThe list represents an ordered, repeatable collection, accessed through an element indexMap represents a collection of mappings, accessed by keyQueue represents an implementation of a collection of queuesThe
Class set: Called a container (container) in C + + and called a class set in JavaCollection (class Set): The most basic collection interface, a Collection represents a set of object collections. Collection (class Set) Special shape:1, elements (Elements) storage:
can store the same elements;
Can not store the same elements;
2. Element (Elements)
Collection is the common interface for list, Set, and queue. The main methods of collection are:int size (): Returns the number of elements in the current collectionBoolean Add (E E): Add object to collectionBoolean remove (Object o): Deletes the specified objectBoolean contains (Object O): finds whether the specified object is in the collectionBoolean containsall (collectionfinds whether the
JVM garbage collection algorithm and jvm garbage collection
1. Mark-cleanup algorithm: the most basic garbage collection algorithm. Just like its name, the algorithm consists of two steps: Marking and cleanup: first, marking the objects to be cleansed, after marking is completed, all marked objects are recycled in a unified manner. The disadvantage of this algori
Details about CMS garbage collection mechanism and cms garbage collection
Originality is not easy. It cannot be reproduced without permission ~~~
In general, the execution process of CMS can be divided into the following stages:
3.1 initial tag (STW)
3.2 concurrent mark
3.3 concurrent pre-cleaning
3.4 mark (STW)
3.5 concurrent cleaning
3.6 Reset
3.1 STW is required for the initial marking stage.
Perform ac
From: http://docs.oracle.com/javase/tutorial/collections/interfaces/index.html
The core set interface encapsulates different types of sets, as shown in. These interfaces allow us to operate the set without having to worry about their specific implementation details. The core set interface is the basis of the Java set framework. As we can see, the core set interface forms a hierarchical structure:
SetIs a special set, andSortedsetIs a special set, and so on. Note that the hierarchy contains two
No. 354, Python distributed crawler build search engine Scrapy explaining-data collection (Stats Collection)Scrapy provides a convenient mechanism for collecting data. The data is stored in Key/value mode, and the values are mostly count values. This mechanism is called the Data Collector (Stats Collector) and can be used through the Crawler API's properties StatsData collectors are always available, regard
The characteristics of map collectionMap collection (double column collection) add a pair of elements at a time, collection collection (single row collection) add one element at a timeThe Map Features:The object that maps the key to a value. A map cannot contain duplicate ke
Set (i)
first, the simple understanding of the collection1. Kan kanSet, that is, to store the data , remember the OOP, we have said that OOP put the data first, and then consider the algorithm to manipulate the data. That is, research data storage, or data structure, let's not talk about data structure of those things. Collections are used to hold data, and there are different ways of storing data, such as arrays, collections. What's the difference between a set and an array?
The root interface in the Collection hierarchy. Collection represents a set of objects, also called collection elements. Some collection allow for duplicate elements, while others are not allowed. Some of the collection are ordered, while others are unordered. JDK does not p
Garbage collection algorithm
Tag-Purge algorithm
The most basic algorithm is the tag-purge (mark-sweep) algorithm. There are two stages of marking and purging: first marking out all objects that need to be recycled, and then uniformly reclaiming all tagged objects when the tag is complete. It is the most basic collection algorithm, because the subsequent
The previous blog spoke about the basic operation of the collection interface, this blog mainly introduces the sub-interface set of the collection interface.Set is an unordered set, its basic operation and collection interface is similar, the main difference is that the set cannot repeat the elements and the collection
Summary of collection collection in 1.JavaCollection|---List (stored in order, repeatable)|---ArrayListThe underlying data structure is an array, query fast , and delete slowly. Thread insecurity, high efficiency|---VectorThe underlying data structure is an array, query fast, and delete slowly.Thread-safe, low-efficiency.|---linkedlistThe underlying data structure is linked list, query slow, delete quickly.
Collection is an interface to the Java collection, collection interfaces inherit iterable Public interface Collection Do not have their own in the drawing of the diagram to find the internet has Big Brother draw the diagram below There may be a wrong place, abstrctlist should inherit from Public abstract class Abstrac
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.