개념 | Java | JavaScript | TypeScript | Python | C
| List / Array | List<T>, ArrayList<T> | Array | Array<T> | list | T arr[], T* |
| Tuple | new Pair<A,B>() (없음 → class 필요) | 배열 대체 사용 ([a, b]) | [T1, T2] (타입 지원) | tuple | struct 사용 |
| Dictionary / Map | Map<K, V> | Object, Map | Record<K, V>, Map<K, V> | dict | struct + 배열 (직접 구현 필요) |
| Set | Set<T> | Set (ES6) | Set<T> | set | 배열 + 중복 제거 로직 |
| Object / Struct | class or POJO | Object (동적 구조) | { key: type } | dict or class | struct |
| Null/None/Undefined | null | null, undefined | null, undefined | None | NULL (포인터) |
주요 자료형별 대응 설명 + 예시
1. List (배열 or 순서 있는 컬렉션)
| Java | List<String> list = new ArrayList<>(); |
| JS | const arr = [1, 2, 3]; |
| TS | const arr: number[] = [1, 2, 3]; |
| Python | arr = [1, 2, 3] |
| C | int arr[3] = {1, 2, 3}; 또는 int* arr = malloc(...) |
2. Tuple (고정 길이, 타입 혼합 가능)
| Java | 직접 Pair, Triple 클래스 정의 필요 |
| JS | const pair = [1, 'a']; (의미론적 튜플) |
| TS | const pair: [number, string] = [1, 'a']; |
| Python | t = (1, 'a') |
| C | struct Pair { int a; char* b; }; |
3. Dictionary / Map (Key-Value)
| Java | Map<String, Integer> map = new HashMap<>(); |
| JS | const obj = { a: 1 }; 또는 new Map() |
| TS | const obj: Record<string, number> = { a: 1 }; |
| Python | d = {'a': 1} |
| C | 구현 필요: struct { char* key; int value; } + 배열 |
4. Set (중복 없는 집합)
| Java | Set<Integer> set = new HashSet<>(); |
| JS | const s = new Set([1, 2, 3]); |
| TS | const s: Set<number> = new Set([1, 2]); |
| Python | s = {1, 2, 3} |
| C | 없음. 배열 + 중복 제거 수동 구현 |
5. Struct/Object (데이터 묶음)
| Java | class User { String name; int age; } |
| JS | const user = { name: 'Alice', age: 20 }; |
| TS | const user: { name: string; age: number } = { ... } |
| Python | class User: def __init__(self): ... or dict |
| C | struct User { char name[20]; int age; }; |
기타 참고 대응
개념 | Java | JS/TS | Python | C |
| JSON 구조 | Map<String, Object> | Object, Record<string, any> | dict | 수동 구현 |
| LinkedList | LinkedList<T> | 직접 구현 필요 | collections.deque | 수동 구현 |
| Queue | Queue<T> | [] + shift() | queue.Queue() | 배열 + 포인터 |
| Stack | Stack<T> | [] + push/pop | list + append/pop | 배열 또는 linked list 구현 |