User experience in streaming platforms depends heavily on the ability to manage personal watchlists. This project demonstrates advanced ArrayList operations for a "To Watch" feature. Key functionalities include:
- Index Search: Using
indexOf()to identify the position of specific elements (e.g., tracking duplicate entries). - Membership Verification: Using
contains()to check for the presence of a title without iterating manually. - Bulk Reset: Utilizing
clear()to perform a complete state reset of the collection. These operations are essential for maintaining clean and responsive user interfaces.
- Predictable Search: Correctly identified the zero-based index of "The Shmatrix".
- Conditional Checking: Implemented a boolean check for "Arvatar" to handle missing data gracefully.
- Resource Management: Demonstrated the
clear()method for efficient memory cleanup of the list contents. - Type Safety: Strictly used
ArrayList<String>to maintain a consistent data model for movie titles.
- Java 8+ (Collections Framework, ArrayList)
- StreamingManagerApp: The main class orchestrating the lifecycle of the user's movie list.
Index of The Shmatrix: 1
Is Arvatar in the list? false
List after clearing: []
Project Structure:
JavaBasics_Task_448/
├── src/
│ └── com/yurii/pavlenko/
│ └── app/
│ └── StreamingManagerApp.java
├── LICENSE
├── TASK.md
├── THEORY.md
└── README.md
Code
package com.yurii.pavlenko.app;
import java.util.ArrayList;
import java.util.List;
public class StreamingManagerApp {
public static void main(String[] args) {
List<String> watchList = new ArrayList<>();
watchList.add("Titanic");
watchList.add("The Shmatrix");
watchList.add("Interstellar");
watchList.add("The Shmatrix");
int shmatrixIndex = watchList.indexOf("The Shmatrix");
System.out.println("Index of The Shmatrix: " + shmatrixIndex);
boolean hasArvatar = watchList.contains("Arvatar");
System.out.println("Is Arvatar in the list? " + hasArvatar);
watchList.clear();
System.out.println("List after clearing: " + watchList);
}
}This project is licensed under the MIT License.
Copyright (c) 2026 Yurii Pavlenko
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files...
License: MIT