list

Programming/Java

[삽질일기] Arrays.asList 와 ArrayList의 차이

코딩을 하다 보면, 배열 또는 List 형태가 아닌 데이터를 List 데이터 타입으로 만들 때 간편하게 Arrays.asLIst 메서드를 활용해서 그동안 리스트 데이터를 만들고 있었다. List score1 = Arrays.asList(1, 2, 3, 4, 5); 그러다가 Arrays.asList로 만든 List A에서 DB에서 조회한 List B의 값을 빼야 하는 경우가 생겼고 아무 생각 없이 다음과 같이 코드를 작성해봤다. List score1 = Arrays.asList(1, 2, 3, 4, 5); // DB에서 값을 가져옴 List score2 = getSomeDataFromDatabase(); // DB 값을 제외한 나머지 값을 찾아보자! score1.removeAll(score2); 그랬더니,..

Programming/Python

[Python-Basic] List Data Type - 1(Add)

kospi_top10 = ['삼성전자', 'SK하이닉스', '현대차', '한국전력', '아모레퍼시픽', '제일모직', '삼성전자우', '삼성생명', 'NAVER', '현대모비스'] # before adding print(kospi_top10) # add new item in list kospi_top10.append('SK텔레콤') print(kospi_top10) # change list name kospi_top11 = kospi_top10 print(kospi_top11) # insert new item after of specific item kospi_top11.insert(0, "JOHNMARK_AGC") print(kospi_top11) 실행결과 $ py list_add.py ['삼성전자',..

JohnMark
'list' 태그의 글 목록