Skip to content

[Tech] Sync completed with main #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
package com.bobocode.LinkedList;

/**
* {@link LinkedList} is a list implementation that is based on singly linked generic nodes. A node is implemented as
* inner static class {@link Node<T>}. In order to keep track on nodes, {@link LinkedList} keeps a reference to a head node.
*
* @param <T> generic type parameter
*/
public class LinkedList<T> implements List<T> {

/**
* This method creates a list of provided elements
*
* @param elements elements to add
* @param <T> generic type
* @return a new list of elements the were passed as method parameters
*/
public static <T> List<T> of(T... elements) {
throw new UnsupportedOperationException("This method is not implemented yet"); // todo: implement this method
}

/**
* Adds an element to the end of the list
*
* @param element element to add
*/
@Override
public void add(T element) {
throw new UnsupportedOperationException("This method is not implemented yet"); // todo: implement this method
}

/**
* Adds a new element to the specific position in the list. In case provided index in out of the list bounds it
* throws {@link IndexOutOfBoundsException}
*
* @param index an index of new element
* @param element element to add
*/
@Override
public void add(int index, T element) {
throw new UnsupportedOperationException("This method is not implemented yet"); // todo: implement this method
}

/**
* Changes the value of an list element at specific position. In case provided index in out of the list bounds it
* throws {@link IndexOutOfBoundsException}
*
* @param index an position of element to change
* @param element a new element value
*/
@Override
public void set(int index, T element) {
throw new UnsupportedOperationException("This method is not implemented yet"); // todo: implement this method
}

/**
* Retrieves an elements by its position index. In case provided index in out of the list bounds it
* throws {@link IndexOutOfBoundsException}
*
* @param index element index
* @return an element value
*/
@Override
public T get(int index) {
throw new UnsupportedOperationException("This method is not implemented yet"); // todo: implement this method
}

/**
* Removes an elements by its position index. In case provided index in out of the list bounds it
* throws {@link IndexOutOfBoundsException}
*
* @param index element index
*/
@Override
public void remove(int index) {
throw new UnsupportedOperationException("This method is not implemented yet"); // todo: implement this method
}


/**
* Checks if a specific exists in he list
*
* @return {@code true} if element exist, {@code false} otherwise
*/
@Override
public boolean contains(T element) {
throw new UnsupportedOperationException("This method is not implemented yet"); // todo: implement this method
}

/**
* Checks if a list is empty
*
* @return {@code true} if list is empty, {@code false} otherwise
*/
@Override
public boolean isEmpty() {
throw new UnsupportedOperationException("This method is not implemented yet"); // todo: implement this method
}

/**
* Returns the number of elements in the list
*
* @return number of elements
*/
@Override
public int size() {
throw new UnsupportedOperationException("This method is not implemented yet"); // todo: implement this method
}

/**
* Removes all list elements
*/
@Override
public void clear() {
throw new UnsupportedOperationException("This method is not implemented yet"); // todo: implement this method
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.bobocode.LinkedList;


public interface List<T> {
void add(T element);

void add(int index, T element);

void set(int index, T element);

T get(int index);

void remove(int index);

boolean contains(T element);

boolean isEmpty();

int size();

void clear();

}
Loading