This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Documented | |
@Retention(RetentionPolicy.CLASS) // default CLASS -> SOURCE, RUNTIME으로 변경할 필요 없음 | |
@Target(ElementType.METHOD) | |
public @interface PerformaceLogging { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
long begin = Sytem.currentTimeMillis(); | |
// do something.... | |
// 기존코드 | |
System.out.println(Sytem.currentTimeMillis() - begin); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
axios.get(url, { | |
responseType: 'arraybuffer' | |
}).then(function (response) { | |
var blob = new Blob([response.data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }); | |
var blobURL = window.URL.createObjectURL(blob); | |
var tempLink = document.createElement('a'); | |
tempLink.style.display = 'none'; | |
tempLink.href = blobURL; | |
tempLink.setAttribute('download', 'test.xlsx'); | |
document.body.appendChild(tempLink); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public int hashCode() { | |
return Objects.hash(getId()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public V put(K key, V value) { | |
return putVal(hash(key), key, value, false, true); | |
} | |
static final int hash(Object key) { | |
int h; | |
return (key == null) ? 0 : (h = key.hashCode()) ^ (h >>> 16); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HashSet<E> | |
extends AbstractSet<E> | |
implements Set<E>, Cloneable, java.io.Serializable | |
{ | |
private transient HashMap<E,Object> map; | |
/** | |
* Constructs a new, empty set; the backing <tt>HashMap</tt> instance has | |
* default initial capacity (16) and load factor (0.75). | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set<Student> studentSet = new HashSet<>(); | |
studentSet.add(leo1); | |
studentSet.add(new Student(1L, "Leo")); | |
System.out.println("studentSet size => " + studentSet.size()); // studentSet size => 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<Student> students = new ArrayList<>(); | |
students.add(leo1); | |
System.out.println("students contains Leo => " + students.contains(new Student(1L, "Leo"))); // true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public boolean equals(Object o) { | |
if (this == o) { | |
return true; | |
} | |
if (!(o instanceof Student)) { | |
return false; | |
} | |
Student student = (Student) o; | |
return Objects.equals(getId(), student.getId()); // Java7+ 부터 사용할 수 있는 `Objects.equals`를 사용해봤다. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.github.leoheo.equals; | |
/** | |
* @author Heo, Jin Han | |
* @since 2018-06-10 | |
*/ | |
public class Student { | |
private Long id; | |
private String name; |
NewerOlder