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
// 간단한 덧셈 뺄섬을 하는 Service class | |
// single responsibility principle도 위반 | |
// 전혀 oop적인 코드도 아니다. | |
class CalculationService { | |
public int calculate(char calculation, int num1, int num2) { | |
if (calculation == '+') { | |
return num1 + num2; | |
} else if (calculation == '-') { | |
return num1 - num2; | |
} |
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; |
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
compile group: 'com.amazonaws', name: 'aws-java-sdk-ses', version: "${awsSesVersion}" |