com.github.grzesiek_galezowski.collections.readonly.implementation.ReadOnlyQueueWrapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of readonly-collections Show documentation
Show all versions of readonly-collections Show documentation
Read-only collection wrappers for Java built-in collections
The newest version!
package com.github.grzesiek_galezowski.collections.readonly.implementation;
import com.github.grzesiek_galezowski.collections.readonly.interfaces.ReadOnlyQueue;
import java.io.Serializable;
import java.util.Queue;
public class ReadOnlyQueueWrapper
extends ReadOnlyCollectionWrapper
implements ReadOnlyQueue, Serializable {
private final Queue original;
public ReadOnlyQueueWrapper(final Queue original) {
super(original);
this.original = original;
}
@Override
public T element() {
return original.element();
}
@Override
public T peek() {
return original.peek();
}
@Override
@SuppressWarnings("checkstyle:all")
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
if (!super.equals(o)) {
return false;
}
ReadOnlyQueueWrapper> that = (ReadOnlyQueueWrapper>) o;
return original != null ? original.equals(that.original) : that.original == null;
}
@Override
@SuppressWarnings("checkstyle:all")
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (original != null ? original.hashCode() : 0);
return result;
}
}