구조매핑
2026년 3월 23일 09:30분
package com.jesusbornd.leviticus;
import java.util.HashMap;
import java.util.Map;
public class Leviticus_15_Chapter_Lv2 {
public static class Counter {
private final Map<String, Integer> counts = new HashMap<String, Integer>();
public void inc(String key) {
Integer v = counts.get(key);
counts.put(key, v == null ? 1 : v + 1);
}
public int get(String key) {
Integer v = counts.get(key);
return v == null ? 0 : v.intValue();
}
}
public static void main(String[] args) {
Counter c = new Counter();
c.inc("부정 / Unclean");
c.inc("부정 / Unclean");
c.inc("정결 / Clean");
System.out.println("unclean=" + c.get("부정 / Unclean"));
System.out.println("clean=" + c.get("정결 / Clean"));
}
}
class Counter:
def __init__(self):
self.counts = {}
def inc(self, key: str):
self.counts[key] = self.counts.get(key, 0) + 1
def get(self, key: str) -> int:
return self.counts.get(key, 0)
c = Counter()
c.inc("부정 / Unclean")
c.inc("부정 / Unclean")
c.inc("정결 / Clean")
print("unclean=", c.get("부정 / Unclean"))
print("clean=", c.get("정결 / Clean"))
Search
Categories
← 목록으로
Comments
같은 행동이 반복될수록 결과가 쌓이는 흐름이 삶의 패턴과도 닮아 있는 느낌입니다.