[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:
@@ -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)
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.baeldung.relationships.aggregation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Car {
|
||||
|
||||
private List<Wheel> wheels;
|
||||
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.baeldung.relationships.aggregation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CarWithStaticInnerWheel {
|
||||
|
||||
private List<Wheel> wheels;
|
||||
|
||||
public static class Wheel {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.baeldung.relationships.aggregation;
|
||||
|
||||
public class Wheel {
|
||||
|
||||
private Car car;
|
||||
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.baeldung.relationships.association;
|
||||
|
||||
public class Child {
|
||||
|
||||
private Mother mother;
|
||||
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.baeldung.relationships.association;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Mother {
|
||||
|
||||
private List<Child> children;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.baeldung.relationships.university;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Department {
|
||||
|
||||
private List<Professor> professors;
|
||||
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package com.baeldung.relationships.university;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Professor {
|
||||
|
||||
private List<Department> department;
|
||||
private List<Professor> friends;
|
||||
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.baeldung.relationships.university;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class University {
|
||||
|
||||
private List<Department> department;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user