✨
Java
  • 자바의 역사
  • Ch1
    • Before Start Java
      • History of Java
      • Feature of Java
      • API Documentation
      • Hello World!
      • eclipse shortcut
      • Eclipse IDE
      • GitHub to eclipse
  • Ch2
    • Variable
      • Variable
    • Variable Type
    • Character and String
    • Primitive type and range
    • printf and formatter
    • Scanner
    • Overflow of Int
    • Transition between different variable types
    • Object Array
  • CH3
    • Operator
  • CH4
    • 조건문과 반복문
    • if statement
    • switch
    • Math.random()
    • for statement
    • while statement
    • break, continue, named iterated statement
  • CH5
    • Array
    • 배열 활용
    • String Array
  • OOP
    • Intro
  • Class and Object
  • Make multiple Classes in one file
  • How to use Object
  • Object Array
  • Variable type according to declared location
  • Class Variable and Instance Variable
  • Method
  • Call Stack
  • Parameter
  • Static method(Class method) and Instance method
  • (Method)Overloading
  • Constructor
  • Constructor this()
  • Reference type variable "this"
  • Initialize variable
  • Inheritance
  • Composite
  • Single Inheritance, Object Class
  • (Method)Overriding
  • super, super()
  • package, class path
  • import, static import
  • modifier
  • access modifier
  • Encapsulation
  • Polymorphism
  • reference type transition
  • instanceof operator
  • Parameter polymorphism
  • Multiple object using one array
  • Abstract Class, Abstract Method
  • Creating Abstract Class
  • Interface
  • Interface Polymorphism
  • Interface Pros
  • Default method and static method
  • Inner Class
  • Anonymous Class
  • java.lang package and useful class
    • Object class
    • hashCode(), toString()
    • String class
    • StringBuffer class
    • StringBuilder class
    • Math class
    • Wrapper class
    • Number class
    • String to Number, String to Wrapper class
    • Auto-boxing and (auto)Unboxing
  • Collection Framework
    • Collections framework
    • List, Set, Map Interface
    • List의 removeAll() 과 clear() 비교
    • List Interface - ArrayList
    • How to view Java API source
    • List Interface - LinkedList
    • Stack and Queue
    • Iterator, ListIterator, Enumeration
    • Array
    • Comparator와 Comparable
    • Stack
    • String
    • String + char = String
    • String.toCharArray()
    • BufferedReader / BufferWriter
    • Scanner로 String 입력 - next( )와 nextLine( )
    • 공백없이 2차원배열 데이터 String으로 한번에 한줄씩 입력받기(문자/숫자)
    • 공백을 사이에 두고 빠른 2차원 배열 입출력
    • arr[index++]과 arr[index] index++의 차이
    • int와 long의 차이
    • Untitled
    • 타입 간의 변환
    • Array 와 ArrayList
    • valueOf()
    • Char
    • 변수, 객체 초기화(초기값 설정)
  • error troubleshooting
    • No enclosing instance of type
    • ASCII Code Table
    • java.lang.NumberFormatException
    • No enclosing instance..
  • reference
    • String을 생성하는 2가지 방법과 차이점
    • StackOverflowError(스택, 힙 메모리)
    • swtich-case 반복문
Powered by GitBook
On this page

Was this helpful?

  1. Collection Framework

Collections framework

PreviousAuto-boxing and (auto)UnboxingNextList, Set, Map Interface

Last updated 4 years ago

Was this helpful?

  • Collection

- 여러 객체(데이터)를 모아 놓은 것을 의미. 자바의 대표적인 자료구조.

  • Framework - 표준화, 정형화된 체계적인 프로그래밍 방식

  • Collections framework - 여러 객체를 정해진 방식대로 프로그래밍하는 것. - 컬렉션(다수의 객체)을 다루기 위한 표준화된 프로그래밍 방식 - 컬렉션을 쉽고 편리하게 다룰 수 있는 다양한 클래스를 제공한다.(저장, 검색, 정렬, 삭제)

  • Collection Class - 다수의 데이터를 저장할 수 있는 클래스(ex, Vector, ArrayList, HashSet)

  • Core interface of collection framework

Interface

Description

List

순서O, 중복O ex) 대기자 명단

=>ArrayList, LinkedList, Stack, Vector 등

순서 있는 데이터들 삽입(insert/addd), 삭제(remove/delete) 빈번하게 발생 : LinkedList, 아닐 경우 ArrayList 사용.

Set

순서X, 중복X ex) 양의 정수집합, 소수의 집합

=>HashSet, TreeSet 등

Map

순서X, 중복 - 키 X, 값 O ex) 우편번호, 지역번호(전화번호)

=>HashMap, TreeMap, Hashtable, Properties 등

추가적으로, 파일 자료구조도 있는데, 파일 구조는 순차파일, 색인파일, 직접파일이 있다.

  • Methods of Collection Interface .

Method

Description

boolean add(Object o)

boolean addAll(Collection c)

추가.

지정된 객체(o) 또는 Collection(c)의 객체들을 Collection에 추가한다.

void clear()

삭제.

Collection의 모든 객체를 삭제한다.

boolean contains(Object o)

boolean containsAll(Collection c)

검색.

지정된 객체(o) 또는 Collection의 객체들이 Collection에 포함되어있는지 확인한다.

boolean equals(Object o)

비교.

동일한 Collection인지 비교한다.

int hashCode()

Collection의 hash code를 반환한다.

boolean isEmpty()

Collection이 비어있는지 확인한다.

iterator iterator()

Collection의 iterator를 얻어서 반환한다.

boolean remove(Object o)

삭제.

지정된 객체를 삭제한다.

boolean removeAll(Collection c)

지정된 Collection에 포함된 객체들을 삭제한다.

boolean retainAll(Collection c)

지정된 Collection에 포함된 객체만을 남기고 다른 객체들은 Collection에서 삭제한다. 이 작업으로 인해 Collection에 변화가 있으면 true를, 그렇지 않으면 false를 반환한다.

int size()

Collection에 저장된 객체의 개수를 반환한다.

Object[ ] toArray()

Collection에 저장된 객체를 객체배열(Object[ ])로 반환한다.

Object[ ] toArray(Object[ ] a)

지정된 배열에 Collection의 객체를 저장해서 반환한다.

Core Interface of Collection Framework