Files
Plex-FAWE/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/queue/QueuePool.java
Matt 96dcb95b7c Javadoc and Formatting fixes. (#619)
Javadoc and Formatting fixes.

Also, extremely minor code changes which have been tested.
This commit is only part one of two commits that aim to fix problems with formatting in our project. In part two I will modify the Google Java Style Guide (since it closely matches our code style) for our project so there is guidance on how to format and document. 

* Updated PlotSquared URL
* Removed plugin acronyms
* Fixed a typo
* Fixed grammar
* Use modern block id's
* Update YouTube video URL
2020-10-05 13:41:41 -04:00

30 lines
633 B
Java

package com.boydti.fawe.beta.implementation.queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.function.Supplier;
public class QueuePool<T> extends ConcurrentLinkedQueue<T> implements Pool<T> {
private final Supplier<T> supplier;
public QueuePool(Supplier<T> supplier) {
this.supplier = supplier;
}
@Override
public T poll() {
T result = super.poll();
if (result == null) {
return supplier.get();
}
return result;
}
@Override
public void clear() {
if (!isEmpty()) {
super.clear();
}
}
}