{"id":20550754,"url":"https://github.com/wildandart/stack","last_synced_at":"2025-04-14T11:18:03.849Z","repository":{"id":253282734,"uuid":"842930943","full_name":"WildandArt/stack","owner":"WildandArt","description":"A generic Stack data structure in Java, supporting basic operations and also prints it. Includes unit tests to ensure correctness and reliability","archived":false,"fork":false,"pushed_at":"2024-08-21T03:59:59.000Z","size":43,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-14T11:17:54.535Z","etag":null,"topics":["datastructuresinjava","java","junit5","maven","stack"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WildandArt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-15T12:18:35.000Z","updated_at":"2024-09-10T07:56:19.000Z","dependencies_parsed_at":"2024-11-16T02:28:52.823Z","dependency_job_id":"a2c89119-bc7d-4f3f-b206-2ee38c1a8eee","html_url":"https://github.com/WildandArt/stack","commit_stats":null,"previous_names":["wildandart/stack"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WildandArt%2Fstack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WildandArt%2Fstack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WildandArt%2Fstack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WildandArt%2Fstack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WildandArt","download_url":"https://codeload.github.com/WildandArt/stack/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248868766,"owners_count":21174758,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["datastructuresinjava","java","junit5","maven","stack"],"created_at":"2024-11-16T02:27:17.164Z","updated_at":"2025-04-14T11:18:03.843Z","avatar_url":"https://github.com/WildandArt.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Java](https://img.shields.io/badge/Java-22-007396?style=for-the-badge\u0026logo=java)\n![JUnit](https://img.shields.io/badge/JUnit-5.0-25A162?style=for-the-badge\u0026logo=junit5)\n\n#   Stack Data Structure\n\n## Overview\n\nThis project implements a generic Stack data structure in Java. It includes basic stack operations such as push, pop, peek, and search, along with unit tests to ensure correctness.\n\n### Interface Documentation\n\nThe `Stack\u003cT\u003e` interface defines the basic operations of a stack data structure, including methods for pushing, popping, peeking, checking if the stack is empty, and searching for elements.\n\n 1. `boolean isEmpty()`\n\n- **Brief:** Checks if the stack is empty.\n- **Description:** This method determines whether the stack contains any elements.\n- **Returns:** \n  - `true` if the stack is empty.\n  - `false` if the stack contains one or more elements.\n\n2. `T peek()`\n\n- **Brief:** Returns the top element of the stack without removing it.\n- **Description:** This method allows the caller to view the element at the top of the stack without modifying the stack.\n- **Returns:** The top element of the stack.\n- **Throws:** `RuntimeException` if the stack is empty.\n\n3. `T pop()`\n\n- **Brief:** Removes and returns the top element of the stack.\n- **Description:** This method removes the top element from the stack and returns it.\n- **Returns:** The top element of the stack.\n- **Throws:** `RuntimeException` if the stack is empty.\n\n4. `T push(T item)`\n\n- **Brief:** Pushes an item onto the top of the stack.\n- **Description:** This method adds an item to the top of the stack.\n- **Parameters:** \n  - `item`: The item to be pushed onto the stack.\n- **Returns:** The item argument that was pushed onto the stack.\n\n5. `int search(T e)`\n\n- **Brief:** Searches for an element in the stack.\n- **Description:** This method searches the stack for a specific element and returns its 1-based position from the top of the stack. If the element is not found, the method returns `-1`.\n- **Parameters:** \n  - `e`: The element to search for.\n- **Returns:** \n  - The 1-based position of the element from the top of the stack.\n  - `-1` if the element is not found.\n\n6. `int size()`\n\n- **Description:** Returns the current number of elements in the stack.\n- **Returns:** The number of elements in the stack.\n\n7. `int capacity()`\n\n- **Description:** Returns the total capacity of the stack.\n- **Returns:** The maximum number of elements the stack can hold.\n\n8. `boolean isFull()`\n\n- **Description:** Checks if the stack is full.\n- **Returns:** `true` if the stack has reached its maximum capacity; `false` otherwise.\n\n\n\n## Prerequisites\n\nBefore you begin, ensure you have the following software installed:\n\n- **Java Development Kit (JDK)**: Version 8 or higher.\n  - You can check if Java is installed by running:\n    ```bash\n    java -version\n    ```\n- **Maven**: Apache Maven is required to build and manage the project.\n\n## Installing Maven\n\nIf Maven is not already installed, follow these steps to install it:\n\n1. **Download Maven**:\n   - Go to the [Apache Maven download page](https://maven.apache.org/download.cgi) and download the binary archive for your operating system.\n\n2. **Extract the Archive**:\n   - Extract the downloaded archive to a directory of your choice, e.g., `/opt/maven`.\n\n3. **Set Up Environment Variables**:\n   - Add Maven's `bin` directory to your `PATH` environment variable.\n   - On Linux/MacOS, you can add the following lines to your `~/.bashrc` or `~/.zshrc` file:\n     ```bash\n     export M2_HOME=/path/to/maven\n     export PATH=$M2_HOME/bin:$PATH\n     ```\n   - On Windows, you can add the `bin` directory to the `Path` environment variable through the System Properties dialog.\n\n4. **Verify Installation**:\n   - Run the following command to verify that Maven is installed correctly:\n     ```bash\n     mvn -version\n     ```\n\n## Project Setup\n\n1. **Clone the Repository**:\n   - Clone the project repository to your local machine:\n     ```bash\n     git clone https://github.com/WildandArt/stack.git\n     ```\n   - Navigate to the project directory:\n     ```bash\n     cd stack\n     ```\n\n2. **Build the Project**:\n   - Run the following command to compile the project and download dependencies:\n     ```bash\n     mvn clean install\n     ```\n\n3. **Run the Project**:\n   - To run the project, ensure that you have a `main` class or executable JAR file. Since this is a library, there may not be a `main` method by default.\n   - If you have a main method, you can run the application as follows:\n     ```bash\n     mvn exec:java -Dexec.mainClass=\"com.stack.project.MainClass\"\n     ```\n   - Replace `\"com.stack.project.MainClass\"` with the actual class containing the `main` method.\n\n## Running Tests\n\nUnit tests are included to verify the functionality of the stack implementation. To run the tests, use the following Maven command:\n\n```bash\nmvn test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwildandart%2Fstack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwildandart%2Fstack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwildandart%2Fstack/lists"}