From b9677dd6e449f0a2cb8659866f0cd7d02ca6e89d Mon Sep 17 00:00:00 2001 From: AnnZhimol Date: Sat, 12 Nov 2022 18:33:16 +0400 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=BC=D0=B5=D0=BD=D0=B0=20=D0=BC?= =?UTF-8?q?=D0=B0=D1=81=D1=81=D0=B8=D0=B2=D0=B0=20=D0=BD=D0=B0=20=D1=81?= =?UTF-8?q?=D0=BF=D0=B8=D1=81=D0=BE=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/CreaterGeneric.java | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/CreaterGeneric.java b/src/CreaterGeneric.java index c1c3f43..692c0c7 100644 --- a/src/CreaterGeneric.java +++ b/src/CreaterGeneric.java @@ -1,25 +1,26 @@ +import java.util.ArrayList; import java.util.Random; public class CreaterGeneric { - Object[] Warships; - Object[] Blocks; + ArrayList Warships; + ArrayList Blocks; int WarshipsCount=0; int BlocksCount=0; public CreaterGeneric(int warshipsCount,int blocksCount){ - Warships=new Object[warshipsCount]; - Blocks=new Object[blocksCount]; + Warships=new ArrayList<>(warshipsCount); + Blocks=new ArrayList<>(blocksCount); } public int AddWarship(T warship){ - if(WarshipsCount