List, Set, Map Interface
Last updated
Was this helpful?
Last updated
Was this helpful?
<Set Interface and Methods> List Interface : Allow Duplicated data and Keep Order.
The Methods that Inherited from Collection Interface are skipped and in previous page.
Method
Description
void add(int index, Object element)
boolean addAll(int index, Collection c)
추가.
지정된 위치(index)에 객체(element) 또는 컬렉션에 포함된 객체들을 추가한다.
Object get(int index)
지정된 위치(index)에 있는 객체를 반환한다.
int indexOf(Object o)
검색.
지정된 객체의 위치(index)를 반환한다.
(List의 첫 번째 요소부터 순방향으로 찾는다.)
int lastIndexOf(Object o)
검색.
지정된 객체의 위치(index)를 반환한다.
(List의 첫 번째 요소부터 역방향으로 찾는다.)
ListIterator listIterator()
ListIterator listIterator(int index)
List의 객체에 접근할 수 있는 ListIterator를 반환한다.
Object remove(int index)
삭제.
지정된 위치(index)에 있는 객체를 삭제하고 삭제된 객체를 반환한다.
Object set(int index, Object element)
지정된 위치(index)에 객체(element)를 저장한다
void sort(Comparator c)
정렬.
지정된 비교자(comparator)로 List를 정렬한다.
List subList(int fromIndex, int toIndex)
지정된 범위(fromIndex부터 toIndex)에 있는 객체를 반환한다.
<Set Interface and Methods>
Method that related to set(If there is change then return true, else return false.)
Method
Description
boolean addAll(Collection c)
지정된 Collection(c)의 객체들을 Collection에 추가한다.(합집합)
boolean containsAll(Collection c)
지정된 Collection의 객체들이 Collection에 포함되어 있는지 확인한다.(부분집합)
boolean removeAll(Collection c)
지정된 Collection에 포함된 객체들을 삭제한다.(차집합)
boolean retainAll(Collection c)
지정된 Collection에 포함된 객체만을 남기고 나머지는 Collection에서 삭제한다.(교집합)
<Set Interface and Methods>
-LinkedHashMap : It matters order. - Hashtable : Old version. - HashMap : New version.
Method
Description
void clear()
Map의 모든 객체를 삭제한다.
boolean containsKey(Object key)
검색.
지정된 key 객체와 일치하는 Map의 key 객체가 있는지 확인한다.
boolean containsValue(Object Value)
검색.
지정된 key 객체와 일치하는 Map의 value 객체가 있는지 확인한다.
Set entrySet()
값을 읽어온다.
Map에 저장되어 있는 key-value 쌍을 Entry 타입의 객체로 저장한 Set으로 반환한다.
boolean equals(Object o)
동일한 Map인지 비교한다.
Object get(Object key)
지정한 key객체에 대응하는 value객체를 찾아서 반환한다.
int hashCode()
해시코드를 반환한다.
boolean isEmpty()
Map이 비어있는지 확인한다.
Set keySet()
값을 읽어온다.
Map에 저장된 모든 key 객체를 반환한다.
Object put(Object key, Object value)
Map에 value객체를 key 객체에 연결(mapping)하여 저장한다.
void putAll(Map t)
지정된 Map의 모든 key-value 쌍을 추가한다.
Object remove(Object key)
지정된 key객체와 일치하는 key-value 객체를 삭제한다.
int size()
Map에 저장된 key-value 쌍의 개수를 반환한다.
Collection values()
값을 읽어온다.
Map에 저장된 모든 value 객체를 반환한다.
Except for header of table, the first row means "Entry". Key is unique and Value(=data concept) can be duplicated.
key
value
myId
1234
asdf
1234