This repository contains small example programs that demonstrate usage of Java collection classes (primarily ArrayList and Vector). The examples are organized into two folders: Array List and Vector. Each file is a compact, self-contained Java class illustrating a specific operation or pattern.
-
Root:
- README.md — this documentation.
- ListInterfaceExmp.java — example using the
Listinterface.
-
Array List/
- Array List/ArrayListClass.java — basic
ArrayListusage and examples. - Array List/ArrayListConverstion.java — conversions between arrays and
ArrayList(note filename spelling). - Array List/FreqNumber.java — frequency/count of numbers in a list/array.
- Array List/LongestSubArray.java — finds the longest subarray according to example logic in the file.
- Array List/MaxNumber.java — finds the maximum element in a collection.
- Array List/MergeArrayList.java — demonstrates merging two
ArrayListinstances. - Array List/RotateArrayList.java — rotates elements in an
ArrayList.
- Array List/ArrayListClass.java — basic
-
Vector/
- Vector/CheckSize.java — checks
Vectorsize and related operations. - Vector/MethodContainsAll.java — demonstrates
containsAlland related methods. - Vector/ObjStore.java — storing objects in a
Vectorand iteration. - Vector/ParameterConsVect.java — examples of constructors / parameter use with
Vector. - Vector/SecondMax.java — finds the second largest element in a collection.
- Vector/SetVectValue.java — setting values by index in a
Vector. - Vector/VectorCapacityCheck.java — demonstrates capacity behavior of
Vector.
- Vector/CheckSize.java — checks
Requirements:
- Java JDK 8 or later installed and
javac/javaon your PATH.
To compile all Java files from the repository root (Windows example):
javac -d out -sourcepath . ListInterfaceExmp.java Array\ List/*.java Vector/*.javaTo run a specific example (replace the class name with the one you want):
java -cp out ListInterfaceExmp- Filenames in the
Array Listfolder contain a space; when referencing them in commands or links, encode or quote the path (e.g.,Array\ List/ArrayListClass.java). - Some files have
.bakcopies in the same folders; these are backups and may contain older versions.
- Add small, focused examples that illustrate collection operations clearly.
- Follow the existing naming pattern and include a short comment at the top of each file describing the example's intent.
This repository does not include a license file. If you want to apply an open-source license, add a LICENSE file at the repository root.
If you'd like, I can also:
- Add a short example README-run script to compile and run a selected example.
- Standardize filenames (remove spaces) and update imports/build instructions.
Updated README to document the project structure and usage.