Package dsa.lab01.solutions
Class StringArray
java.lang.Object
dsa.lab01.solutions.StringArray
- All Implemented Interfaces:
StringContainer
An array-based string container.
Contains some number of strings using an array.
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct an empty string array.StringArray(String... strings) Construct a string array containing the given strings. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dsa.lab01.base.StringContainer
isEmpty
-
Constructor Details
-
StringArray
public StringArray()Construct an empty string array. -
StringArray
Construct a string array containing the given strings.- Parameters:
strings- the strings
-
-
Method Details
-
size
public int size()Description copied from interface:StringContainerGet the number of contained strings.- Specified by:
sizein interfaceStringContainer- Returns:
- the size
-
contains
Description copied from interface:StringContainerCheck if the given string is equal to any of those contained.- Specified by:
containsin interfaceStringContainer- Parameters:
string- the string to check for membership- Returns:
- whether such a string is contained
-