본문 바로가기

Backend/Java

ArrayList에 DTO 객체 저장

db5 복사해서 다음과 같이 변경

  • DAO 클래스의 selectStudent() 메서드에서 한 행씩 출력 
  • → 모든 행을 ArrayList에 담아서
  • StudentSelect 클래스의 select() 메서드에게 반환
  • select() 메서드에서 출력

 

db6

  • 모든 클래스 복사해서 수정
  • DAO 클래스의 selectStudent() 메서드의 반환형을 ArrayList<StudentDTO> 변경
  • StudentSelect 클래스의 select()
  • StudentDTO 클래스에 toString() 추가 : StringBuilder 사용

 

'Backend > Java' 카테고리의 다른 글

ArrayList와 LinkedList와 처리 시간 비교  (0) 2021.11.30
LinkedList  (0) 2021.11.30
컬렉션 프레임워크(Collection Framework)  (0) 2021.11.30
제네릭 (Generic)  (0) 2021.11.29
DTO DAO 구현 예제  (0) 2021.11.26