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 BufferedInputStream(InputStream in) |
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 BufferedInputStream(InputStream in, int size) |
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 Car { | |
private String type; | |
private BigDecimal price; | |
public Car(String type, BigDecimal price) { | |
this.type = type; | |
this.price = price; | |
} | |
public String getType() { |
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
class Car { | |
private String type; | |
private BigDecimal price; | |
public Car(String type, BigDecimal price) { | |
this.type = type; | |
this.price = price; | |
} |
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 static void main(String[] args) { | |
Car fiat1 = new Car("Fiat", new BigDecimal(4000)); | |
Car fiat2 = new Car("Fiat", new BigDecimal(4000)); | |
System.out.println(fiat2.hashCode() == fiat1.hashCode()); //false | |
System.out.println(fiat2.equals(fiat1)); //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 int hashCode() { | |
return Objects.hash(getType(), getPrice()); | |
} |
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
class Car { | |
private String carType; | |
public Car(String type) { | |
this.carType = type; | |
} | |
public String getCarType() { | |
return carType; |
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
Map safeMap = Collections.synchronizedMap(new HashMap<>()); |
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
BufferedInputStream bufferedInputStream = new BufferedInputStream(new FileInputStream("test.txt")); |
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
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(new FileOutputStream("test.txt")); |
OlderNewer