<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    我思故我強

    第九部分:集合類框架

    第九部分:集合類框架

    • 知道如何在特定的條件下選擇適合的集合類/接口。
    • 能正確地實現hashcode方法。

    第一節          所有接口和class定義

    1:Set

    public interface Set extends Collection

    A collection that contains no duplicate elements. More formally, sets contain no pair of elements e1 and e2 such that e1.equals(e2), and at most one null element. As implied by its name, this interface models the mathematical set abstraction.

     

    2:SortedSet

    public interface SortedSet extends Set.

    A set that further guarantees that its iterator will traverse the set in ascending element order, sorted according to the natural ordering of its elements (see Comparable), or by a Comparator provided at sorted set creation time.

     

    3:HashSet

    public class HashSet extends AbstractSet implements Set, Cloneable, Serializable

    This class implements the Set interface, backed by a hash table (actually a HashMap instance). It makes no guarantees as to the iteration order of the set; in particular, it does not guarantee that the order will remain constant over time. This class permits the null element.

     

    4:TreeSet

    public class TreeSet extends AbstractSet implements SortedSet, Cloneable, Serializable

    This class implements the Set interface, backed by a TreeMap instance. This class guarantees that the sorted set will be in ascending element order, sorted according to the natural order of the elements (see Comparable), or by the comparator provided at set creation time, depending on which constructor is used.

     

    5:LinkedHashSet:

    public class LinkedHashSet extends HashSet implements Set, Cloneable, Serializable

    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.)

     

     

     

    5:Map

    public interface Map

    An object that maps keys to values. A map cannot contain duplicate keys; each key can map to at most one value.

     

    6:SortedMap

    public interface SortedMap extends Map

    A map that further guarantees that it will be in ascending key order, sorted according to the natural ordering of its keys (see the Comparable interface), or by a comparator provided at sorted map creation time. (This interface is the map analogue of the SortedSet interface.)

     

    7:HashMap(允許key和value為NULL)

    public class HashMap extends AbstractMap implements Map, Cloneable, Serializable

    Hash table based implementation of the Map interface. This implementation provides all of the optional map operations, and permits null values and the null key. (The HashMap class is roughly equivalent to Hashtable, except that it is unsynchronized and permits nulls.) This class makes no guarantees as to the order of the map; in particular, it does not guarantee that the order will remain constant over time

     

    8:TreeMap

    public class TreeMap extends AbstractMap implements SortedMap, Cloneable, Serializable

    Red-Black tree based implementation of the SortedMap interface. This class guarantees that the map will be in ascending key order, sorted according to the natural order for the key's class (see Comparable), or by the comparator provided at creation time, depending on which constructor is used.

     

    9:HashTable(不允許key和value為NULL)

    public class Hashtable extends Dictionary implements Map, Cloneable, Serializable.

    This class implements a hashtable, which maps keys to values. Any non-null object can be used as a key or as a value.

     

    9:LinkedHashMap

    public class LinkedHashMap extends HashMap

    Hash table and linked list implementation of the Map interface, with predictable iteration order. This implementation differs from HashMap in that it maintains a doubly-linked list running through all of its entries. This linked list defines the iteration ordering, which is normally the order in which keys were inserted into the map (insertion-order). Note that insertion order is not affected if a key is re-inserted into the map. (A key k is reinserted into a map m if m.put(k, v) is invoked when m.containsKey(k) would return true immediately prior to the invocation.)

     

    9:IdentityHashMap

    public class IdentityHashMap extends AbstractMap implements Map, Serializable, Cloneable

    This class implements the Map interface with a hash table, using reference-equality in place of object-equality when comparing keys (and values). In other words, in an IdentityHashMap, two keys k1 and k2 are considered equal if and only if (k1==k2). (In normal Map implementations (like HashMap) two keys k1 and k2 are considered equal if and only if (k1==null ? k2==null : k1.equals(k2)).)

    This class is not a general-purpose Map implementation! While this class implements the Map interface, it intentionally violates Map's general contract, which mandates the use of the equals method when comparing objects. This class is designed for use only in the rare cases wherein reference-equality semantics are required.

     

     

    10:List

    public interface List extends Collection

    An ordered collection (also known as a sequence). The user of this interface has precise control over where in the list each element is inserted. The user can access elements by their integer index (position in the list), and search for elements in the list.

     

    Unlike sets, lists typically allow duplicate elements. More formally, lists typically allow pairs of elements e1 and e2 such that e1.equals(e2), and they typically allow multiple null elements if they allow null elements at all.

     

    11:ArrayList

    public class ArrayList extends AbstractList implements List, Cloneable, Serializable

    Resizable-array implementation of the List interface. Implements all optional list operations, and permits all elements, including null. In addition to implementing the List interface, this class provides methods to manipulate the size of the array that is used internally to store the list. (This class is roughly equivalent to Vector, except that it is unsynchronized.)

     

    12:LinkedList

    public class LinkedList extends AbstractSequentialList implements List, Cloneable, Serializable

    Linked list implementation of the List interface. Implements all optional list operations, and permits all elements (including null). In addition to implementing the List interface, the LinkedList class provides uniformly named methods to get, remove and insert an element at the beginning and end of the list. These operations allow linked lists to be used as a stack, queue, or double-ended queue (deque).

     

    13:Vector

    public class Vector extends AbstractList implements List, Cloneable, Serializable

    The Vector class implements a growable array of objects. Like an array, it contains components that can be accessed using an integer index. However, the size of a Vector can grow or shrink as needed to accommodate adding and removing items after the Vector has been created.

     

    14:Collection

    public interface Collection

    The root interface in the collection hierarchy. A collection represents a group of objects, known as its elements. Some collections allow duplicate elements and others do not. Some are ordered and others unordered. The SDK does not provide any direct implementations of this interface: it provides implementations of more specific subinterfaces like Set and List. This interface is typically used to pass collections around and manipulate them where maximum generality is desired.

    15:Collections

    public class Collections extends Object

    This class consists exclusively of static methods that operate on or return collections. It contains polymorphic algorithms that operate on collections, "wrappers", which return a new collection backed by a specified collection, and a few other odds and ends.

    posted on 2009-10-16 11:44 李云澤 閱讀(468) 評論(0)  編輯  收藏 所屬分類: 面試筆試相關的SCJP認證學習

    主站蜘蛛池模板: 久久久精品免费视频| 久久精品国产亚洲AV蜜臀色欲| 亚洲AV成人影视在线观看| 无码久久精品国产亚洲Av影片| 一区二区三区四区免费视频| 国产一二三四区乱码免费| 2022免费国产精品福利在线| 亚洲五月午夜免费在线视频| 成年大片免费高清在线看黄| 国产精品亚洲综合一区在线观看| 亚洲国产成人私人影院| 亚洲国产人成网站在线电影动漫| 色吊丝最新永久免费观看网站| 丁香花在线视频观看免费| 亚洲一区二区三区免费| 国产一二三四区乱码免费| 国产成人精品无码免费看| 69视频在线观看高清免费| 男女免费观看在线爽爽爽视频 | 久久九九亚洲精品| 亚洲综合另类小说色区| 亚洲人色婷婷成人网站在线观看| 四虎影视www四虎免费| 国产精品无码一二区免费| 国产精品免费看香蕉| 亚洲一级Av无码毛片久久精品 | 国产男女爽爽爽免费视频| 日韩在线视频免费 | 国产精品xxxx国产喷水亚洲国产精品无码久久一区 | 四虎在线播放免费永久视频 | a级毛片在线免费看| 99视频在线免费| 久久久久久国产精品免费免费| 日韩精品无码免费专区午夜| 日韩中文字幕免费视频| 真人做A免费观看| 国产在线ts人妖免费视频| 亚洲日韩精品一区二区三区| 亚洲午夜久久影院| 亚洲日韩AV无码一区二区三区人| 亚洲婷婷综合色高清在线|