[JAVA-621] core-java-lang-oop-patterns module

* Creation

* Moved code from https://www.baeldung.com/java-composition-aggregation-association

* Moved code from https://www.baeldung.com/java-inheritance-composition

* Moved code from https://www.baeldung.com/java-immutable-object

* Moved code from https://www.baeldung.com/java-deep-copy

* Moved article references to the new README.md
This commit is contained in:
dupirefr
2020-04-02 21:24:31 +02:00
parent 29a0cc015f
commit af08d3814b
38 changed files with 55 additions and 3 deletions

View File

@@ -8,7 +8,6 @@ This module contains articles about Object-oriented programming (OOP) in Java
- [Guide to the super Java Keyword](https://www.baeldung.com/java-super)
- [Guide to the this Java Keyword](https://www.baeldung.com/java-this)
- [Java public Access Modifier](https://www.baeldung.com/java-public-keyword)
- [Composition, Aggregation, and Association in Java](https://www.baeldung.com/java-composition-aggregation-association)
- [Nested Classes in Java](https://www.baeldung.com/java-nested-classes)
- [A Guide to Inner Interfaces in Java](https://www.baeldung.com/java-inner-interfaces)
- [Java Classes and Objects](https://www.baeldung.com/java-classes-objects)

View File

@@ -1,9 +0,0 @@
package com.baeldung.relationships.aggregation;
import java.util.List;
public class Car {
private List<Wheel> wheels;
}

View File

@@ -1,13 +0,0 @@
package com.baeldung.relationships.aggregation;
import java.util.List;
public class CarWithStaticInnerWheel {
private List<Wheel> wheels;
public static class Wheel {
}
}

View File

@@ -1,7 +0,0 @@
package com.baeldung.relationships.aggregation;
public class Wheel {
private Car car;
}

View File

@@ -1,7 +0,0 @@
package com.baeldung.relationships.association;
public class Child {
private Mother mother;
}

View File

@@ -1,9 +0,0 @@
package com.baeldung.relationships.association;
import java.util.List;
public class Mother {
private List<Child> children;
}

View File

@@ -1,18 +0,0 @@
package com.baeldung.relationships.composition;
import java.util.List;
public class Building {
private String address;
private List<Room> rooms;
public class Room {
public String getBuildingAddress() {
return Building.this.address;
}
}
}

View File

@@ -1,28 +0,0 @@
package com.baeldung.relationships.composition;
public class BuildingWithDefinitionRoomInMethod {
public Room createAnonymousRoom() {
return new Room() {
@Override
public void doInRoom() {}
};
}
public Room createInlineRoom() {
class InlineRoom implements Room {
@Override
public void doInRoom() {}
}
return new InlineRoom();
}
public Room createLambdaRoom() {
return () -> {};
}
public interface Room {
void doInRoom();
}
}

View File

@@ -1,9 +0,0 @@
package com.baeldung.relationships.university;
import java.util.List;
public class Department {
private List<Professor> professors;
}

View File

@@ -1,10 +0,0 @@
package com.baeldung.relationships.university;
import java.util.List;
public class Professor {
private List<Department> department;
private List<Professor> friends;
}

View File

@@ -1,9 +0,0 @@
package com.baeldung.relationships.university;
import java.util.List;
public class University {
private List<Department> department;
}