mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-27 06:23:08 +08:00
Add automatic linter (#4214)
This commit is contained in:
@ -123,8 +123,7 @@ public class LinkedQueue<T> implements Iterable<T> {
|
||||
*/
|
||||
|
||||
public T peek(int pos) {
|
||||
if (pos > size)
|
||||
throw new IndexOutOfBoundsException("Position %s out of range!".formatted(pos));
|
||||
if (pos > size) throw new IndexOutOfBoundsException("Position %s out of range!".formatted(pos));
|
||||
Node<T> node = front;
|
||||
while (pos-- > 0) node = node.next;
|
||||
return node.data;
|
||||
|
Reference in New Issue
Block a user