객체

    js - 현재 페이지 url 관련 (location 객체)

    1. 자주 사용하는 location 객체 // Ex) https://test.com:80/newpost?type=post window.location.href // Ex) https: window.location.protocol // Ex) test.com:80 window.location.host // Ex) test.com window.location.hostname // Ex) 80 window.location.port // Ex) newpost window.location.pathname // Ex) ?type=post window.location.search 2. 참고 https://hianna.tistory.com/464

    java - 객체가 저장된 List 오름차순과 내림차순 정렬

    개요 일반 문자, 숫자를 저장한 리스트를 정렬할때와는 달리 객체를 오름/내림차순으로 정렬할때는 어떤 것을 기준으로 정렬할지 정해주어야 한다. Collections 클래스에서 제공해주는 메소드를 이용하여 정렬을 진행한다. 오름차순 정렬 import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; public class Main { public static void main(String[] args) { // 정렬할 리스트 생성 List articles = new ArrayList(); articles.add(new Article(1, "제목1")); articles.add..