Skip to content

Commit

Permalink
#2 - Feat: Ut.mapOf() 도입
Browse files Browse the repository at this point in the history
  • Loading branch information
ahah525 committed Nov 8, 2022
1 parent 4c258b7 commit 886bdf2
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,28 @@
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.Calendar;
import java.util.LinkedHashMap;
import java.util.Map;

public class Ut {
// 인자 값들을 map 형태로 반환
public static<K, V> Map<K, V> mapOf(Object... args) {
Map<K, V> map = new LinkedHashMap<>();

int size = args.length / 2;

for (int i = 0; i < size; i++) {
int keyIndex = i * 2;
int valueIndex = keyIndex + 1;

K key = (K) args[keyIndex];
V value = (V) args[valueIndex];

map.put(key, value);
}
return map;
}

public static class spring {
public static <T> ResponseEntity<RsData> responseEntityOf(RsData<T> rsData) {
return responseEntityOf(rsData, null);
Expand Down

0 comments on commit 886bdf2

Please sign in to comment.