From 00af902200919c84144625f5624b4cdfaa33d982 Mon Sep 17 00:00:00 2001 From: ekallin Date: Tue, 7 Nov 2023 00:40:53 +0400 Subject: [PATCH] Created class LocomotivesGenericStorage --- .idea/java.iml | 11 ++++++++++ .idea/modules.xml | 2 +- .../LocomotiveGenericCollection.java | 20 ++++++++++++------- ProjectElectricLocomotive/SetGeneric.java | 13 ++++++------ 4 files changed, 31 insertions(+), 15 deletions(-) create mode 100644 .idea/java.iml diff --git a/.idea/java.iml b/.idea/java.iml new file mode 100644 index 0000000..b107a2d --- /dev/null +++ b/.idea/java.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml index 561b3e5..a127731 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,7 +2,7 @@ - + \ No newline at end of file diff --git a/ProjectElectricLocomotive/LocomotiveGenericCollection.java b/ProjectElectricLocomotive/LocomotiveGenericCollection.java index cf1207c..0aeddea 100644 --- a/ProjectElectricLocomotive/LocomotiveGenericCollection.java +++ b/ProjectElectricLocomotive/LocomotiveGenericCollection.java @@ -7,9 +7,11 @@ public class LocomotiveGenericCollection _collection; @@ -24,7 +26,6 @@ public class LocomotiveGenericCollection{ return _places.get(position); } + public T Get(int position) + { + if (position < 0 || position >= Count()) return null; + return _places.get(position); + } + public Iterable GetLocomotives(final Integer maxLocomotives) { return new Iterable() { @Override @@ -80,11 +86,4 @@ public class SetGeneric{ } }; } - -// public T Get(int position) -// { -// // TODO проверка позиции -// if (position < 0 || position >= Count()) return null; -// return _places[position]; -// } } \ No newline at end of file