mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2025-02-05 06:31:25 +01:00
Extract lambda to class
This commit is contained in:
parent
90e26af19b
commit
aade3ddbfe
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) filoghost and contributors
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
package me.filoghost.holographicdisplays.plugin.hologram.tracking;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class DelegateViewers<T extends Viewer> implements Viewers<T> {
|
||||
|
||||
private final Collection<T> viewers;
|
||||
|
||||
public DelegateViewers(Collection<T> viewers) {
|
||||
this.viewers = viewers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forEach(Consumer<? super T> action) {
|
||||
viewers.forEach(action);
|
||||
}
|
||||
|
||||
}
|
@ -25,7 +25,7 @@ public abstract class LineTracker<T extends Viewer> {
|
||||
|
||||
protected LineTracker() {
|
||||
this.viewers = new HashMap<>();
|
||||
this.iterableViewers = action -> viewers.values().forEach(action);
|
||||
this.iterableViewers = new DelegateViewers<>(viewers.values());
|
||||
}
|
||||
|
||||
protected abstract BaseHologramLine getLine();
|
||||
|
Loading…
Reference in New Issue
Block a user