[BAEL-10839] - Added missed class and moved articles related to hashcode and equals
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
### Relevant Articles:
|
||||
- [Guide to Java Reflection](http://www.baeldung.com/java-reflection)
|
||||
- [Introduction to Java Generics](http://www.baeldung.com/java-generics)
|
||||
- [Generate equals() and hashCode() with Eclipse](http://www.baeldung.com/java-eclipse-equals-and-hashcode)
|
||||
- [Chained Exceptions in Java](http://www.baeldung.com/java-chained-exceptions)
|
||||
- [Java Primitive Conversions](http://www.baeldung.com/java-primitive-conversions)
|
||||
- [Call Methods at Runtime Using Java Reflection](http://www.baeldung.com/java-method-reflection)
|
||||
@@ -40,4 +39,3 @@
|
||||
- [How to Separate Double into Integer and Decimal Parts](https://www.baeldung.com/java-separate-double-into-integer-decimal-parts)
|
||||
- [“Sneaky Throws” in Java](http://www.baeldung.com/java-sneaky-throws)
|
||||
- [Retrieving a Class Name in Java](https://www.baeldung.com/java-class-name)
|
||||
- [Java equals() and hashCode() Contracts](https://www.baeldung.com/java-equals-hashcode-contracts)
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.baeldung.immutableobjects;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class ImmutableObjectsUnitTest {
|
||||
|
||||
@Test
|
||||
public void whenCallingStringReplace_thenStringDoesNotMutate() {
|
||||
// 2. What's an Immutable Object?
|
||||
final String name = "baeldung";
|
||||
final String newName = name.replace("dung", "----");
|
||||
|
||||
assertEquals("baeldung", name);
|
||||
assertEquals("bael----", newName);
|
||||
}
|
||||
|
||||
public void whenReassignFinalValue_thenCompilerError() {
|
||||
// 3. The final Keyword in Java (1)
|
||||
final String name = "baeldung";
|
||||
// name = "bael...";
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenAddingElementToList_thenSizeChange() {
|
||||
// 3. The final Keyword in Java (2)
|
||||
final List<String> strings = new ArrayList<>();
|
||||
assertEquals(0, strings.size());
|
||||
strings.add("baeldung");
|
||||
assertEquals(1, strings.size());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user