com.github.ccob.bittrex4j.Observable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bittrex4j Show documentation
Show all versions of bittrex4j Show documentation
A java library for accessing the Bittrex Exchange Web API and Web Sockets.
/*
* *
* This file is part of the bittrex4j project.
*
* @author CCob
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
* /
*/
package com.github.ccob.bittrex4j;
import com.github.ccob.bittrex4j.listeners.Listener;
import java.util.LinkedList;
import java.util.List;
public class Observable {
private List> _observers =
new LinkedList<>();
public void addObserver(Listener obs) {
if (obs == null) {
throw new IllegalArgumentException("Tried to add a null observer");
}
if (_observers.contains(obs)) {
return;
}
_observers.add(obs);
}
public void notifyObservers(ObservedType data) {
for (Listener obs : _observers) {
obs.onEvent(data);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy