From 5c4a4e390334cfbb20967a3739f8aafa706265d4 Mon Sep 17 00:00:00 2001 From: artem Date: Mon, 29 Jul 2024 17:03:40 +0100 Subject: [PATCH] generics-hello --- .../src/main/java/com/bobocode/basics/Box.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/1-0-java-basics/1-3-0-hello-generics/src/main/java/com/bobocode/basics/Box.java b/1-0-java-basics/1-3-0-hello-generics/src/main/java/com/bobocode/basics/Box.java index 5a2d860ee..bf138b133 100644 --- a/1-0-java-basics/1-3-0-hello-generics/src/main/java/com/bobocode/basics/Box.java +++ b/1-0-java-basics/1-3-0-hello-generics/src/main/java/com/bobocode/basics/Box.java @@ -5,20 +5,20 @@ * is flexible, because we can store anything we want there. But it is not safe, because it requires runtime casting * and there is no guarantee that we know the type of the stored value. *

- * todo: refactor this class so it uses generic type "T" and run {@link com.bobocode.basics.BoxTest} to verify it + * todo: refactor this class so it uses generic type "T" and run {@link com.bobocode.basics} to verify it */ -public class Box { - private Object value; +public class Box { + private T value; - public Box(Object value) { - this.value = value; + public Box(T value) { + this.value = value; } - public Object getValue() { + public T getValue() { return value; } - public void setValue(Object value) { + public void setValue(T value) { this.value = value; } }