-
Numeric Datatype개발입문/JAVA 2017. 9. 10. 13:29
DataTypebyte, short, int, long 그리고 Precision Java Datatype> https://www.hackerrank.com/challenges/java-datatypes?h_r=next-challenge&h_v=zen A byte is an 8-bit signed integer. - 2^7 ~ 2^7-1A short is a 16-bit signed integer. - 2^15 ~ 2^15-1An int is a 32-bit signed integer. - 2^31 ~ 2^31-1A long is a 64-bit signed integer. - 2^63 ~ 2^63-1 첫자리는 부호 + 다음자리부터 Bit 0 or 1이걸 가지고 한참을 헤매다니...
-
Java String Formatting개발입문/JAVA 2017. 9. 10. 12:36
Formatter, REGEX 는 아직 어렵다.예를 들어, 테이블 컬럼에 15자가 들어가고,그 안에 String 값이 1~15자부터 자유롭게 들어갈 수 있을 때, 패딩을 어떻게 유동적으로 주어야하는가. Java Output Formatting> https://www.hackerrank.com/challenges/java-output-formatting Q. 이걸 도대체 어떻게 검색하죠? 내가 검색한 쿼리: String space format 영어 표현: pad a given string찾았다! String Formatter> https://stackoverflow.com/questions/388461/how-can-i-pad-a-string-in-java down voteSince 1.5, String...
-
Java API 분석__Set, HashSet, TreeSet, LinkedHashSet개발입문/자료구조 2017. 7. 25. 16:35
Set public interface Setextends Collection 순서에 상관없이, 어떤 데이터가 존재하는지를 확인하기 위한 용도로 많이 사용된다. 중복되는 것을 방지하고, 원하는 값이 포함되어 있는지를 확인하는 것이 주 용도이다. 1. HashSet: 순서가 전혀 필요없는 데이터를 해시 테이블 hash table 에 저장한다. Set 중에서 가장 성능이 좋다. 2. TreeSet: 저장된 데이터의 값에 따라서 정렬되는 셋이다. red-black 이라는 트리 tree 타입으로 값이 저장되며, HashSet 보다 약간 성능이 느리다. 3. LinkedHashSet: 연결된 목록 타입으로 구현된 해시 테이블에 데이터를 저장한다. 저장된 순서에 따라서 값이 정렬된다. 대신 성능이 이 셋 중에서 가장..
-
Java API 분석__LinkedList개발입문/JAVA 2017. 7. 25. 15:56
public class LinkedList extends AbstractSequentialList implements List, Deque, Cloneable, Serializable 1. LinkedList 는 배열보다 메모리 공간 측면에서 훨씬 유리하다. - 배열과 같은 ArrayList 와 Vector 는 각 위치가 정해져있고, 그 위치로 데이터를 찾는다. 그래서 추가 삭제를 하면 메모리 위치를 이동해야 한다! - 그에 반해 LinkedList 는 중간에 있는 데이터를 삭제하면, 지운 데이터의 앞에 있는 데이터와 뒤에 있는 데이터를 연결하면 그만이다.위치를 맞추기 위해서 값을 이동하는 단계를 거칠 필요가 없다는 뜻! 2. LinkedList 는 List 뿐 아니라 Queue 와 Deque 인터페이스..
-
Java API 분석__Class Vector개발입문/자료구조 2017. 7. 25. 14:53
Vectorpublic class Vector extends AbstractList implements List, RandomAccess, Cloneable, Serializable The Vector class implements a growable array of objects. Like an array, it contains components that can be accessed using an integer index. However, the size of a Vector can grow or shrink as needed to accommodate adding and removing items after the Vector has been created. Each vector tries to ..
-
Java API 분석__Class Stack개발입문/자료구조 2017. 7. 24. 19:09
Stack java.lang.Objectjava.util.AbstractCollectionjava.util.AbstractListjava.util.Vectorjava.util.Stack public class Stack extends Vector The Stack class represents a last-in-first-out (LIFO) stack of objects. It extends class Vector with five operations that allow a vector to be treated as a stack. The usual push and pop operations are provided, as well as a method to peek at the top item on th..
-
Java API 분석__Class ArrayList개발입문/자료구조 2017. 7. 24. 15:35
ArrayList public class ArrayList extends AbstractList implements List, RandomAccess, Cloneable, SerializableResizable-array implementation of the List interface. Implements all optional list operations, and permits all elements, including null. In addition to implementing the List interface, this class provides methods to manipulate the size of the array that is used internally to store the list..
-
Java API 분석__ Interface List개발입문/자료구조 2017. 7. 24. 15:34
List Interface public interface Listextends Collection An ordered collection (also known as a sequence). The user of this interface has precise control over where in the list each element is inserted. The user can access elements by their integer index (position in the list), and search for elements in the list. Unlike sets, lists typically allow duplicate elements. Superinterfaces:Collection, I..