Replace Guava newArrayList()/newLinkedList() with direct call to the JDK 7 constructor.

This is recommended by deprecation comment in Guava.
This commit is contained in:
Sean Gilligan 2019-05-30 19:23:15 -07:00 committed by Andreas Schildbach
parent 05ab09b40b
commit 806afa0441
27 changed files with 57 additions and 75 deletions

View file

@ -22,7 +22,6 @@ import org.bitcoinj.script.ScriptChunk;
import org.bitcoinj.script.ScriptPattern; import org.bitcoinj.script.ScriptPattern;
import com.google.common.base.MoreObjects; import com.google.common.base.MoreObjects;
import com.google.common.collect.Lists;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
@ -314,7 +313,7 @@ public class BloomFilter extends Message {
public synchronized FilteredBlock applyAndUpdate(Block block) { public synchronized FilteredBlock applyAndUpdate(Block block) {
List<Transaction> txns = block.getTransactions(); List<Transaction> txns = block.getTransactions();
List<Sha256Hash> txHashes = new ArrayList<>(txns.size()); List<Sha256Hash> txHashes = new ArrayList<>(txns.size());
List<Transaction> matched = Lists.newArrayList(); List<Transaction> matched = new ArrayList<>();
byte[] bits = new byte[(int) Math.ceil(txns.size() / 8.0)]; byte[] bits = new byte[(int) Math.ceil(txns.size() / 8.0)];
for (int i = 0; i < txns.size(); i++) { for (int i = 0; i < txns.size(); i++) {
Transaction tx = txns.get(i); Transaction tx = txns.get(i);

View file

@ -33,7 +33,6 @@ import com.google.common.base.MoreObjects;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.google.common.base.Throwables; import com.google.common.base.Throwables;
import com.google.common.collect.Lists;
import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -904,7 +903,7 @@ public class Peer extends PeerSocketHandler {
lock.lock(); lock.lock();
try { try {
// Build the request for the missing dependencies. // Build the request for the missing dependencies.
List<ListenableFuture<Transaction>> futures = Lists.newArrayList(); List<ListenableFuture<Transaction>> futures = new ArrayList<>();
GetDataMessage getdata = new GetDataMessage(params); GetDataMessage getdata = new GetDataMessage(params);
if (needToRequest.size() > 1) if (needToRequest.size() > 1)
log.info("{}: Requesting {} transactions for depth {} dep resolution", getAddress(), needToRequest.size(), depth + 1); log.info("{}: Requesting {} transactions for depth {} dep resolution", getAddress(), needToRequest.size(), depth + 1);
@ -920,7 +919,7 @@ public class Peer extends PeerSocketHandler {
public void onSuccess(List<Transaction> transactions) { public void onSuccess(List<Transaction> transactions) {
// Once all transactions either were received, or we know there are no more to come ... // Once all transactions either were received, or we know there are no more to come ...
// Note that transactions will contain "null" for any positions that weren't successful. // Note that transactions will contain "null" for any positions that weren't successful.
List<ListenableFuture<Object>> childFutures = Lists.newLinkedList(); List<ListenableFuture<Object>> childFutures = new LinkedList<>();
for (Transaction tx : transactions) { for (Transaction tx : transactions) {
if (tx == null) continue; if (tx == null) continue;
log.info("{}: Downloaded dependency of {}: {}", getAddress(), rootTxHash, tx.getTxId()); log.info("{}: Downloaded dependency of {}: {}", getAddress(), rootTxHash, tx.getTxId());

View file

@ -926,7 +926,7 @@ public class PeerGroup implements TransactionBroadcaster {
int maxPeersToDiscoverCount = this.vMaxPeersToDiscoverCount; int maxPeersToDiscoverCount = this.vMaxPeersToDiscoverCount;
long peerDiscoveryTimeoutMillis = this.vPeerDiscoveryTimeoutMillis; long peerDiscoveryTimeoutMillis = this.vPeerDiscoveryTimeoutMillis;
final Stopwatch watch = Stopwatch.createStarted(); final Stopwatch watch = Stopwatch.createStarted();
final List<PeerAddress> addressList = Lists.newLinkedList(); final List<PeerAddress> addressList = new LinkedList<>();
for (PeerDiscovery peerDiscovery : peerDiscoverers /* COW */) { for (PeerDiscovery peerDiscovery : peerDiscoverers /* COW */) {
InetSocketAddress[] addresses; InetSocketAddress[] addresses;
try { try {

View file

@ -41,7 +41,6 @@ import org.slf4j.LoggerFactory;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.google.common.base.Splitter; import com.google.common.base.Splitter;
import com.google.common.collect.Lists;
import com.google.common.collect.Ordering; import com.google.common.collect.Ordering;
import com.google.common.io.BaseEncoding; import com.google.common.io.BaseEncoding;
@ -532,7 +531,7 @@ public class Utils {
return 0; return 0;
// This would be much easier in a functional language (or in Java 8). // This would be much easier in a functional language (or in Java 8).
items = Ordering.natural().reverse().sortedCopy(items); items = Ordering.natural().reverse().sortedCopy(items);
LinkedList<Pair> pairs = Lists.newLinkedList(); LinkedList<Pair> pairs = new LinkedList<>();
pairs.add(new Pair(items.get(0), 0)); pairs.add(new Pair(items.get(0), 0));
for (int item : items) { for (int item : items) {
Pair pair = pairs.getLast(); Pair pair = pairs.getLast();

View file

@ -16,7 +16,6 @@
package org.bitcoinj.net; package org.bitcoinj.net;
import com.google.common.collect.Lists;
import org.bitcoinj.core.BloomFilter; import org.bitcoinj.core.BloomFilter;
import org.bitcoinj.core.PeerFilterProvider; import org.bitcoinj.core.PeerFilterProvider;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
@ -57,7 +56,7 @@ public class FilterMerger {
} }
public Result calculate(ImmutableList<PeerFilterProvider> providers) { public Result calculate(ImmutableList<PeerFilterProvider> providers) {
LinkedList<PeerFilterProvider> begunProviders = Lists.newLinkedList(); LinkedList<PeerFilterProvider> begunProviders = new LinkedList<>();
try { try {
// All providers must be in a consistent, unchanging state because the filter is a merged one that's // All providers must be in a consistent, unchanging state because the filter is a merged one that's
// large enough for all providers elements: if a provider were to get more elements in the middle of the // large enough for all providers elements: if a provider were to get more elements in the middle of the

View file

@ -17,11 +17,8 @@
package org.bitcoinj.net.discovery; package org.bitcoinj.net.discovery;
import com.google.common.collect.Lists;
import org.bitcoinj.core.NetworkParameters; import org.bitcoinj.core.NetworkParameters;
import org.bitcoinj.core.VersionMessage; import org.bitcoinj.core.VersionMessage;
import org.bitcoinj.net.discovery.HttpDiscovery;
import org.bitcoinj.net.discovery.DnsDiscovery.DnsSeedDiscovery; import org.bitcoinj.net.discovery.DnsDiscovery.DnsSeedDiscovery;
import org.bitcoinj.utils.*; import org.bitcoinj.utils.*;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -56,7 +53,7 @@ public class MultiplexingDiscovery implements PeerDiscovery {
* @param services Required services as a bitmask, e.g. {@link VersionMessage#NODE_NETWORK}. * @param services Required services as a bitmask, e.g. {@link VersionMessage#NODE_NETWORK}.
*/ */
public static MultiplexingDiscovery forServices(NetworkParameters params, long services) { public static MultiplexingDiscovery forServices(NetworkParameters params, long services) {
List<PeerDiscovery> discoveries = Lists.newArrayList(); List<PeerDiscovery> discoveries = new ArrayList<>();
HttpDiscovery.Details[] httpSeeds = params.getHttpSeeds(); HttpDiscovery.Details[] httpSeeds = params.getHttpSeeds();
if (httpSeeds != null) { if (httpSeeds != null) {
OkHttpClient httpClient = new OkHttpClient(); OkHttpClient httpClient = new OkHttpClient();
@ -86,7 +83,7 @@ public class MultiplexingDiscovery implements PeerDiscovery {
public InetSocketAddress[] getPeers(final long services, final long timeoutValue, final TimeUnit timeoutUnit) throws PeerDiscoveryException { public InetSocketAddress[] getPeers(final long services, final long timeoutValue, final TimeUnit timeoutUnit) throws PeerDiscoveryException {
vThreadPool = createExecutor(); vThreadPool = createExecutor();
try { try {
List<Callable<InetSocketAddress[]>> tasks = Lists.newArrayList(); List<Callable<InetSocketAddress[]>> tasks = new ArrayList<>();
for (final PeerDiscovery seed : seeds) { for (final PeerDiscovery seed : seeds) {
tasks.add(new Callable<InetSocketAddress[]>() { tasks.add(new Callable<InetSocketAddress[]>() {
@Override @Override
@ -96,7 +93,7 @@ public class MultiplexingDiscovery implements PeerDiscovery {
}); });
} }
final List<Future<InetSocketAddress[]>> futures = vThreadPool.invokeAll(tasks, timeoutValue, timeoutUnit); final List<Future<InetSocketAddress[]>> futures = vThreadPool.invokeAll(tasks, timeoutValue, timeoutUnit);
ArrayList<InetSocketAddress> addrs = Lists.newArrayList(); ArrayList<InetSocketAddress> addrs = new ArrayList<>();
for (int i = 0; i < futures.size(); i++) { for (int i = 0; i < futures.size(); i++) {
Future<InetSocketAddress[]> future = futures.get(i); Future<InetSocketAddress[]> future = futures.get(i);
if (future.isCancelled()) { if (future.isCancelled()) {

View file

@ -23,7 +23,6 @@ import org.bitcoinj.script.ScriptBuilder;
import com.google.common.base.MoreObjects; import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.google.protobuf.ByteString; import com.google.protobuf.ByteString;
import com.google.protobuf.InvalidProtocolBufferException; import com.google.protobuf.InvalidProtocolBufferException;
import org.bitcoin.protocols.payments.Protos; import org.bitcoin.protocols.payments.Protos;
@ -186,7 +185,7 @@ public class PaymentProtocol {
// The ordering of certificates is defined by the payment protocol spec to be the same as what the Java // The ordering of certificates is defined by the payment protocol spec to be the same as what the Java
// crypto API requires - convenient! // crypto API requires - convenient!
CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509");
certs = Lists.newArrayList(); certs = new ArrayList<>();
for (ByteString bytes : protoCerts.getCertificateList()) for (ByteString bytes : protoCerts.getCertificateList())
certs.add((X509Certificate) certificateFactory.generateCertificate(bytes.newInput())); certs.add((X509Certificate) certificateFactory.generateCertificate(bytes.newInput()));
CertPath path = certificateFactory.generateCertPath(certs); CertPath path = certificateFactory.generateCertPath(certs);

View file

@ -21,7 +21,6 @@ package org.bitcoinj.script;
import org.bitcoinj.core.*; import org.bitcoinj.core.*;
import org.bitcoinj.crypto.TransactionSignature; import org.bitcoinj.crypto.TransactionSignature;
import com.google.common.collect.Lists;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.bouncycastle.crypto.digests.RIPEMD160Digest; import org.bouncycastle.crypto.digests.RIPEMD160Digest;
@ -108,7 +107,7 @@ public class Script {
/** Creates an empty script that serializes to nothing. */ /** Creates an empty script that serializes to nothing. */
private Script() { private Script() {
chunks = Lists.newArrayList(); chunks = new ArrayList<>();
} }
// Used from ScriptBuilder. // Used from ScriptBuilder.
@ -481,7 +480,7 @@ public class Script {
if (!ScriptPattern.isSentToMultisig(this)) if (!ScriptPattern.isSentToMultisig(this))
throw new ScriptException(ScriptError.SCRIPT_ERR_UNKNOWN_ERROR, "Only usable for multisig scripts."); throw new ScriptException(ScriptError.SCRIPT_ERR_UNKNOWN_ERROR, "Only usable for multisig scripts.");
ArrayList<ECKey> result = Lists.newArrayList(); ArrayList<ECKey> result = new ArrayList<>();
int numKeys = Script.decodeFromOpN(chunks.get(chunks.size() - 2).opcode); int numKeys = Script.decodeFromOpN(chunks.get(chunks.size() - 2).opcode);
for (int i = 0 ; i < numKeys ; i++) for (int i = 0 ; i < numKeys ; i++)
result.add(ECKey.fromPublicOnly(chunks.get(1 + i).data)); result.add(ECKey.fromPublicOnly(chunks.get(1 + i).data));

View file

@ -18,8 +18,6 @@
package org.bitcoinj.script; package org.bitcoinj.script;
import com.google.common.collect.Lists;
import org.bitcoinj.core.Address; import org.bitcoinj.core.Address;
import org.bitcoinj.core.LegacyAddress; import org.bitcoinj.core.LegacyAddress;
import org.bitcoinj.core.ECKey; import org.bitcoinj.core.ECKey;
@ -35,6 +33,7 @@ import java.math.BigInteger;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
@ -52,7 +51,7 @@ public class ScriptBuilder {
/** Creates a fresh ScriptBuilder with an empty program. */ /** Creates a fresh ScriptBuilder with an empty program. */
public ScriptBuilder() { public ScriptBuilder() {
chunks = Lists.newLinkedList(); chunks = new LinkedList<>();
} }
/** Creates a fresh ScriptBuilder with the given program as the starting point. */ /** Creates a fresh ScriptBuilder with the given program as the starting point. */

View file

@ -18,7 +18,6 @@
package org.bitcoinj.store; package org.bitcoinj.store;
import com.google.common.collect.Lists;
import org.bitcoinj.core.*; import org.bitcoinj.core.*;
import org.bitcoinj.script.Script; import org.bitcoinj.script.Script;
import org.bitcoinj.script.Script.ScriptType; import org.bitcoinj.script.Script.ScriptType;
@ -557,7 +556,7 @@ public abstract class DatabaseFullPrunedBlockStore implements FullPrunedBlockSto
StoredBlock storedGenesisHeader = new StoredBlock(params.getGenesisBlock().cloneAsHeader(), params.getGenesisBlock().getWork(), 0); StoredBlock storedGenesisHeader = new StoredBlock(params.getGenesisBlock().cloneAsHeader(), params.getGenesisBlock().getWork(), 0);
// The coinbase in the genesis block is not spendable. This is because of how Bitcoin Core inits // The coinbase in the genesis block is not spendable. This is because of how Bitcoin Core inits
// its database - the genesis transaction isn't actually in the db so its spent flags can never be updated. // its database - the genesis transaction isn't actually in the db so its spent flags can never be updated.
List<Transaction> genesisTransactions = Lists.newLinkedList(); List<Transaction> genesisTransactions = new LinkedList<>();
StoredUndoableBlock storedGenesis = new StoredUndoableBlock(params.getGenesisBlock().getHash(), genesisTransactions); StoredUndoableBlock storedGenesis = new StoredUndoableBlock(params.getGenesisBlock().getHash(), genesisTransactions);
put(storedGenesisHeader, storedGenesis); put(storedGenesisHeader, storedGenesis);
setChainHead(storedGenesisHeader); setChainHead(storedGenesisHeader);

View file

@ -51,7 +51,6 @@ import org.slf4j.LoggerFactory;
import static org.fusesource.leveldbjni.JniDBFactory.*; import static org.fusesource.leveldbjni.JniDBFactory.*;
import com.google.common.base.Stopwatch; import com.google.common.base.Stopwatch;
import com.google.common.collect.Lists;
/** /**
* <p> * <p>
@ -331,7 +330,7 @@ public class LevelDBFullPrunedBlockStore implements FullPrunedBlockStore {
// because of how the reference client inits // because of how the reference client inits
// its database - the genesis transaction isn't actually in the db // its database - the genesis transaction isn't actually in the db
// so its spent flags can never be updated. // so its spent flags can never be updated.
List<Transaction> genesisTransactions = Lists.newLinkedList(); List<Transaction> genesisTransactions = new LinkedList<>();
StoredUndoableBlock storedGenesis = new StoredUndoableBlock(params.getGenesisBlock().getHash(), StoredUndoableBlock storedGenesis = new StoredUndoableBlock(params.getGenesisBlock().getHash(),
genesisTransactions); genesisTransactions);
beginDatabaseBatchWrite(); beginDatabaseBatchWrite();

View file

@ -18,7 +18,6 @@ package org.bitcoinj.store;
import org.bitcoinj.core.*; import org.bitcoinj.core.*;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.*; import java.util.*;
@ -260,7 +259,7 @@ public class MemoryFullPrunedBlockStore implements FullPrunedBlockStore {
try { try {
StoredBlock storedGenesisHeader = new StoredBlock(params.getGenesisBlock().cloneAsHeader(), params.getGenesisBlock().getWork(), 0); StoredBlock storedGenesisHeader = new StoredBlock(params.getGenesisBlock().cloneAsHeader(), params.getGenesisBlock().getWork(), 0);
// The coinbase in the genesis block is not spendable // The coinbase in the genesis block is not spendable
List<Transaction> genesisTransactions = Lists.newLinkedList(); List<Transaction> genesisTransactions = new LinkedList<>();
StoredUndoableBlock storedGenesis = new StoredUndoableBlock(params.getGenesisBlock().getHash(), genesisTransactions); StoredUndoableBlock storedGenesis = new StoredUndoableBlock(params.getGenesisBlock().getHash(), genesisTransactions);
put(storedGenesisHeader, storedGenesis); put(storedGenesisHeader, storedGenesis);
setChainHead(storedGenesisHeader); setChainHead(storedGenesisHeader);

View file

@ -26,7 +26,6 @@ import org.bitcoinj.utils.Threading;
import org.bitcoinj.wallet.listeners.KeyChainEventListener; import org.bitcoinj.wallet.listeners.KeyChainEventListener;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.google.protobuf.ByteString; import com.google.protobuf.ByteString;
import org.bouncycastle.crypto.params.KeyParameter; import org.bouncycastle.crypto.params.KeyParameter;
@ -608,7 +607,7 @@ public class BasicKeyChain implements EncryptableKeyChain {
public List<ECKey> findKeysBefore(long timeSecs) { public List<ECKey> findKeysBefore(long timeSecs) {
lock.lock(); lock.lock();
try { try {
List<ECKey> results = Lists.newLinkedList(); List<ECKey> results = new LinkedList<>();
for (ECKey key : hashToKeys.values()) { for (ECKey key : hashToKeys.values()) {
final long keyTime = key.getCreationTimeSeconds(); final long keyTime = key.getCreationTimeSeconds();
if (keyTime < timeSecs) { if (keyTime < timeSecs) {

View file

@ -43,8 +43,6 @@ import java.util.concurrent.Executor;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;
import static com.google.common.base.Preconditions.*; import static com.google.common.base.Preconditions.*;
import static com.google.common.collect.Lists.newArrayList;
import static com.google.common.collect.Lists.newLinkedList;
/** /**
* <p>A deterministic key chain is a {@link KeyChain} that uses the * <p>A deterministic key chain is a {@link KeyChain} that uses the
@ -730,7 +728,7 @@ public class DeterministicKeyChain implements EncryptableKeyChain {
@Override @Override
public List<Protos.Key> serializeToProtobuf() { public List<Protos.Key> serializeToProtobuf() {
List<Protos.Key> result = newArrayList(); List<Protos.Key> result = new ArrayList<>();
lock.lock(); lock.lock();
try { try {
result.addAll(serializeMyselfToProtobuf()); result.addAll(serializeMyselfToProtobuf());
@ -743,7 +741,7 @@ public class DeterministicKeyChain implements EncryptableKeyChain {
protected List<Protos.Key> serializeMyselfToProtobuf() { protected List<Protos.Key> serializeMyselfToProtobuf() {
// Most of the serialization work is delegated to the basic key chain, which will serialize the bulk of the // Most of the serialization work is delegated to the basic key chain, which will serialize the bulk of the
// data (handling encryption along the way), and letting us patch it up with the extra data we care about. // data (handling encryption along the way), and letting us patch it up with the extra data we care about.
LinkedList<Protos.Key> entries = newLinkedList(); LinkedList<Protos.Key> entries = new LinkedList<>();
if (seed != null) { if (seed != null) {
Protos.Key.Builder mnemonicEntry = BasicKeyChain.serializeEncryptableItem(seed); Protos.Key.Builder mnemonicEntry = BasicKeyChain.serializeEncryptableItem(seed);
mnemonicEntry.setType(Protos.Key.Type.DETERMINISTIC_MNEMONIC); mnemonicEntry.setType(Protos.Key.Type.DETERMINISTIC_MNEMONIC);
@ -795,21 +793,21 @@ public class DeterministicKeyChain implements EncryptableKeyChain {
* key rotation it can happen that there are multiple chains found. * key rotation it can happen that there are multiple chains found.
*/ */
public static List<DeterministicKeyChain> fromProtobuf(List<Protos.Key> keys, @Nullable KeyCrypter crypter, KeyChainFactory factory) throws UnreadableWalletException { public static List<DeterministicKeyChain> fromProtobuf(List<Protos.Key> keys, @Nullable KeyCrypter crypter, KeyChainFactory factory) throws UnreadableWalletException {
List<DeterministicKeyChain> chains = newLinkedList(); List<DeterministicKeyChain> chains = new LinkedList<>();
DeterministicSeed seed = null; DeterministicSeed seed = null;
DeterministicKeyChain chain = null; DeterministicKeyChain chain = null;
int lookaheadSize = -1; int lookaheadSize = -1;
int sigsRequiredToSpend = 1; int sigsRequiredToSpend = 1;
List<ChildNumber> accountPath = newArrayList(); List<ChildNumber> accountPath = new ArrayList<>();
Script.ScriptType outputScriptType = Script.ScriptType.P2PKH; Script.ScriptType outputScriptType = Script.ScriptType.P2PKH;
PeekingIterator<Protos.Key> iter = Iterators.peekingIterator(keys.iterator()); PeekingIterator<Protos.Key> iter = Iterators.peekingIterator(keys.iterator());
while (iter.hasNext()) { while (iter.hasNext()) {
Protos.Key key = iter.next(); Protos.Key key = iter.next();
final Protos.Key.Type t = key.getType(); final Protos.Key.Type t = key.getType();
if (t == Protos.Key.Type.DETERMINISTIC_MNEMONIC) { if (t == Protos.Key.Type.DETERMINISTIC_MNEMONIC) {
accountPath = newArrayList(); accountPath = new ArrayList<>();
for (int i : key.getAccountPathList()) { for (int i : key.getAccountPathList()) {
accountPath.add(new ChildNumber(i)); accountPath.add(new ChildNumber(i));
} }
@ -855,7 +853,7 @@ public class DeterministicKeyChain implements EncryptableKeyChain {
throw new UnreadableWalletException("Deterministic key missing extra data: " + key.toString()); throw new UnreadableWalletException("Deterministic key missing extra data: " + key.toString());
byte[] chainCode = key.getDeterministicKey().getChainCode().toByteArray(); byte[] chainCode = key.getDeterministicKey().getChainCode().toByteArray();
// Deserialize the path through the tree. // Deserialize the path through the tree.
LinkedList<ChildNumber> path = newLinkedList(); LinkedList<ChildNumber> path = new LinkedList<>();
for (int i : key.getDeterministicKey().getPathList()) for (int i : key.getDeterministicKey().getPathList())
path.add(new ChildNumber(i)); path.add(new ChildNumber(i));
// Deserialize the public key and path. // Deserialize the public key and path.

View file

@ -494,7 +494,7 @@ public class KeyChainGroup implements KeyBag {
public int importKeysAndEncrypt(final List<ECKey> keys, KeyParameter aesKey) { public int importKeysAndEncrypt(final List<ECKey> keys, KeyParameter aesKey) {
// TODO: Firstly check if the aes key can decrypt any of the existing keys successfully. // TODO: Firstly check if the aes key can decrypt any of the existing keys successfully.
checkState(keyCrypter != null, "Not encrypted"); checkState(keyCrypter != null, "Not encrypted");
LinkedList<ECKey> encryptedKeys = Lists.newLinkedList(); LinkedList<ECKey> encryptedKeys = new LinkedList<>();
for (ECKey key : keys) { for (ECKey key : keys) {
if (key.isEncrypted()) if (key.isEncrypted())
throw new IllegalArgumentException("Cannot provide already encrypted keys"); throw new IllegalArgumentException("Cannot provide already encrypted keys");
@ -848,7 +848,7 @@ public class KeyChainGroup implements KeyBag {
if (basic != null) if (basic != null)
result = basic.serializeToProtobuf(); result = basic.serializeToProtobuf();
else else
result = Lists.newArrayList(); result = new ArrayList<>();
if (chains != null) if (chains != null)
for (DeterministicKeyChain chain : chains) for (DeterministicKeyChain chain : chains)
result.addAll(chain.serializeToProtobuf()); result.addAll(chain.serializeToProtobuf());
@ -1037,7 +1037,7 @@ public class KeyChainGroup implements KeyBag {
private static void extractFollowingKeychains(List<DeterministicKeyChain> chains) { private static void extractFollowingKeychains(List<DeterministicKeyChain> chains) {
// look for following key chains and map them to the watch keys of followed keychains // look for following key chains and map them to the watch keys of followed keychains
List<DeterministicKeyChain> followingChains = Lists.newArrayList(); List<DeterministicKeyChain> followingChains = new ArrayList<>();
for (Iterator<DeterministicKeyChain> it = chains.iterator(); it.hasNext(); ) { for (Iterator<DeterministicKeyChain> it = chains.iterator(); it.hasNext(); ) {
DeterministicKeyChain chain = it.next(); DeterministicKeyChain chain = it.next();
if (chain.isFollowing()) { if (chain.isFollowing()) {
@ -1047,7 +1047,7 @@ public class KeyChainGroup implements KeyBag {
if (!(chain instanceof MarriedKeyChain)) if (!(chain instanceof MarriedKeyChain))
throw new IllegalStateException(); throw new IllegalStateException();
((MarriedKeyChain)chain).setFollowingKeyChains(followingChains); ((MarriedKeyChain)chain).setFollowingKeyChains(followingChains);
followingChains = Lists.newArrayList(); followingChains = new ArrayList<>();
} }
} }
} }

View file

@ -22,7 +22,6 @@ import org.bitcoinj.script.Script;
import org.bitcoinj.script.ScriptException; import org.bitcoinj.script.ScriptException;
import org.bitcoinj.script.ScriptPattern; import org.bitcoinj.script.ScriptPattern;
import com.google.common.collect.Lists;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -54,7 +53,7 @@ public class KeyTimeCoinSelector implements CoinSelector {
@Override @Override
public CoinSelection select(Coin target, List<TransactionOutput> candidates) { public CoinSelection select(Coin target, List<TransactionOutput> candidates) {
try { try {
LinkedList<TransactionOutput> gathered = Lists.newLinkedList(); LinkedList<TransactionOutput> gathered = new LinkedList<>();
Coin valueGathered = Coin.ZERO; Coin valueGathered = Coin.ZERO;
for (TransactionOutput output : candidates) { for (TransactionOutput output : candidates) {
if (ignorePending && !isConfirmed(output)) if (ignorePending && !isConfirmed(output))

View file

@ -31,6 +31,7 @@ import org.bitcoinj.script.Script;
import org.bitcoinj.script.ScriptBuilder; import org.bitcoinj.script.ScriptBuilder;
import org.bouncycastle.crypto.params.KeyParameter; import org.bouncycastle.crypto.params.KeyParameter;
import java.util.ArrayList;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -40,7 +41,6 @@ import javax.annotation.Nullable;
import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState; import static com.google.common.base.Preconditions.checkState;
import static com.google.common.collect.Lists.newArrayList;
/** /**
* <p>A multi-signature keychain using synchronized HD keys (a.k.a HDM)</p> * <p>A multi-signature keychain using synchronized HD keys (a.k.a HDM)</p>
@ -185,7 +185,7 @@ public class MarriedKeyChain extends DeterministicKeyChain {
checkState(numLeafKeysIssued() == 0, "Active keychain already has keys in use"); checkState(numLeafKeysIssued() == 0, "Active keychain already has keys in use");
checkState(followingKeyChains == null); checkState(followingKeyChains == null);
List<DeterministicKeyChain> followingKeyChains = Lists.newArrayList(); List<DeterministicKeyChain> followingKeyChains = new ArrayList<>();
for (DeterministicKey key : followingAccountKeys) { for (DeterministicKey key : followingAccountKeys) {
checkArgument(key.getPath().size() == getAccountPath().size(), "Following keys have to be account keys"); checkArgument(key.getPath().size() == getAccountPath().size(), "Following keys have to be account keys");
@ -219,7 +219,7 @@ public class MarriedKeyChain extends DeterministicKeyChain {
@Override @Override
public List<Protos.Key> serializeToProtobuf() { public List<Protos.Key> serializeToProtobuf() {
List<Protos.Key> result = newArrayList(); List<Protos.Key> result = new ArrayList<>();
lock.lock(); lock.lock();
try { try {
for (DeterministicKeyChain chain : followingKeyChains) { for (DeterministicKeyChain chain : followingKeyChains) {

View file

@ -1012,7 +1012,7 @@ public class Wallet extends BaseTaggableObject
* @return how many addresses were added successfully * @return how many addresses were added successfully
*/ */
public int addWatchedAddresses(final List<Address> addresses, long creationTime) { public int addWatchedAddresses(final List<Address> addresses, long creationTime) {
List<Script> scripts = Lists.newArrayList(); List<Script> scripts = new ArrayList<>();
for (Address address : addresses) { for (Address address : addresses) {
Script script = ScriptBuilder.createOutputScript(address); Script script = ScriptBuilder.createOutputScript(address);
@ -1071,7 +1071,7 @@ public class Wallet extends BaseTaggableObject
* @return true if successful * @return true if successful
*/ */
public boolean removeWatchedAddresses(final List<Address> addresses) { public boolean removeWatchedAddresses(final List<Address> addresses) {
List<Script> scripts = Lists.newArrayList(); List<Script> scripts = new ArrayList<>();
for (Address address : addresses) { for (Address address : addresses) {
Script script = ScriptBuilder.createOutputScript(address); Script script = ScriptBuilder.createOutputScript(address);
@ -3224,7 +3224,7 @@ public class Wallet extends BaseTaggableObject
lock.lock(); lock.lock();
keyChainGroupLock.lock(); keyChainGroupLock.lock();
try { try {
LinkedList<TransactionOutput> candidates = Lists.newLinkedList(); LinkedList<TransactionOutput> candidates = new LinkedList<>();
for (Transaction tx : Iterables.concat(unspent.values(), pending.values())) { for (Transaction tx : Iterables.concat(unspent.values(), pending.values())) {
if (excludeImmatureCoinbases && !tx.isMature()) continue; if (excludeImmatureCoinbases && !tx.isMature()) continue;
for (TransactionOutput output : tx.getOutputs()) { for (TransactionOutput output : tx.getOutputs()) {
@ -3747,7 +3747,7 @@ public class Wallet extends BaseTaggableObject
public Coin value; public Coin value;
public BalanceType type; public BalanceType type;
} }
@GuardedBy("lock") private List<BalanceFutureRequest> balanceFutureRequests = Lists.newLinkedList(); @GuardedBy("lock") private List<BalanceFutureRequest> balanceFutureRequests = new LinkedList<>();
/** /**
* <p>Returns a future that will complete when the balance of the given type has becom equal or larger to the given * <p>Returns a future that will complete when the balance of the given type has becom equal or larger to the given
@ -4436,7 +4436,7 @@ public class Wallet extends BaseTaggableObject
protected LinkedList<TransactionOutput> calculateAllSpendCandidatesFromUTXOProvider(boolean excludeImmatureCoinbases) { protected LinkedList<TransactionOutput> calculateAllSpendCandidatesFromUTXOProvider(boolean excludeImmatureCoinbases) {
checkState(lock.isHeldByCurrentThread()); checkState(lock.isHeldByCurrentThread());
UTXOProvider utxoProvider = checkNotNull(vUTXOProvider, "No UTXO provider has been set"); UTXOProvider utxoProvider = checkNotNull(vUTXOProvider, "No UTXO provider has been set");
LinkedList<TransactionOutput> candidates = Lists.newLinkedList(); LinkedList<TransactionOutput> candidates = new LinkedList<>();
try { try {
int chainHeight = utxoProvider.getChainHeadHeight(); int chainHeight = utxoProvider.getChainHeadHeight();
for (UTXO output : getStoredOutputsFromUTXOProvider()) { for (UTXO output : getStoredOutputsFromUTXOProvider()) {
@ -4680,7 +4680,7 @@ public class Wallet extends BaseTaggableObject
Collections.reverse(newBlocks); // Need bottom-to-top but we get top-to-bottom. Collections.reverse(newBlocks); // Need bottom-to-top but we get top-to-bottom.
// For each block in the old chain, disconnect the transactions in reverse order. // For each block in the old chain, disconnect the transactions in reverse order.
LinkedList<Transaction> oldChainTxns = Lists.newLinkedList(); LinkedList<Transaction> oldChainTxns = new LinkedList<>();
for (Sha256Hash blockHash : oldBlockHashes) { for (Sha256Hash blockHash : oldBlockHashes) {
for (TxOffsetPair pair : mapBlockTx.get(blockHash)) { for (TxOffsetPair pair : mapBlockTx.get(blockHash)) {
Transaction tx = pair.tx; Transaction tx = pair.tx;
@ -4795,7 +4795,7 @@ public class Wallet extends BaseTaggableObject
//region Bloom filtering //region Bloom filtering
private final ArrayList<TransactionOutPoint> bloomOutPoints = Lists.newArrayList(); private final ArrayList<TransactionOutPoint> bloomOutPoints = new ArrayList<>();
// Used to track whether we must automatically begin/end a filter calculation and calc outpoints/take the locks. // Used to track whether we must automatically begin/end a filter calculation and calc outpoints/take the locks.
private final AtomicInteger bloomFilterGuard = new AtomicInteger(0); private final AtomicInteger bloomFilterGuard = new AtomicInteger(0);
@ -5411,7 +5411,7 @@ public class Wallet extends BaseTaggableObject
boolean sign) throws DeterministicUpgradeRequiresPassword { boolean sign) throws DeterministicUpgradeRequiresPassword {
checkState(lock.isHeldByCurrentThread()); checkState(lock.isHeldByCurrentThread());
checkState(keyChainGroupLock.isHeldByCurrentThread()); checkState(keyChainGroupLock.isHeldByCurrentThread());
List<Transaction> results = Lists.newLinkedList(); List<Transaction> results = new LinkedList<>();
// TODO: Handle chain replays here. // TODO: Handle chain replays here.
final long keyRotationTimestamp = vKeyRotationTimestamp; final long keyRotationTimestamp = vKeyRotationTimestamp;
if (keyRotationTimestamp == 0) return results; // Nothing to do. if (keyRotationTimestamp == 0) return results; // Nothing to do.

View file

@ -37,7 +37,6 @@ import org.bitcoinj.utils.ExchangeRate;
import org.bitcoinj.utils.Fiat; import org.bitcoinj.utils.Fiat;
import org.bitcoinj.wallet.Protos.Wallet.EncryptionType; import org.bitcoinj.wallet.Protos.Wallet.EncryptionType;
import com.google.common.collect.Lists;
import com.google.protobuf.ByteString; import com.google.protobuf.ByteString;
import com.google.protobuf.CodedInputStream; import com.google.protobuf.CodedInputStream;
import com.google.protobuf.CodedOutputStream; import com.google.protobuf.CodedOutputStream;
@ -503,7 +502,7 @@ public class WalletProtobufSerializer {
} }
Wallet wallet = factory.create(params, keyChainGroup); Wallet wallet = factory.create(params, keyChainGroup);
List<Script> scripts = Lists.newArrayList(); List<Script> scripts = new ArrayList<>();
for (Protos.Script protoScript : walletProto.getWatchedScriptList()) { for (Protos.Script protoScript : walletProto.getWatchedScriptList()) {
try { try {
Script script = Script script =

View file

@ -39,6 +39,7 @@ import org.bouncycastle.crypto.params.KeyParameter;
import java.io.InputStream; import java.io.InputStream;
import java.math.BigInteger; import java.math.BigInteger;
import java.security.SignatureException; import java.security.SignatureException;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
@ -73,7 +74,7 @@ public class ECKeyTest {
// issue that can allow someone to change a transaction [hash] without invalidating the signature. // issue that can allow someone to change a transaction [hash] without invalidating the signature.
final int ITERATIONS = 10; final int ITERATIONS = 10;
ListeningExecutorService executor = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(ITERATIONS)); ListeningExecutorService executor = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(ITERATIONS));
List<ListenableFuture<ECKey.ECDSASignature>> sigFutures = Lists.newArrayList(); List<ListenableFuture<ECKey.ECDSASignature>> sigFutures = new ArrayList<>();
final ECKey key = new ECKey(); final ECKey key = new ECKey();
for (byte i = 0; i < ITERATIONS; i++) { for (byte i = 0; i < ITERATIONS; i++) {
final Sha256Hash hash = Sha256Hash.of(new byte[]{i}); final Sha256Hash hash = Sha256Hash.of(new byte[]{i});

View file

@ -17,7 +17,6 @@
package org.bitcoinj.core; package org.bitcoinj.core;
import com.google.common.collect.*;
import org.bitcoinj.core.TransactionConfidence.*; import org.bitcoinj.core.TransactionConfidence.*;
import org.bitcoinj.store.*; import org.bitcoinj.store.*;
import org.bitcoinj.testing.*; import org.bitcoinj.testing.*;
@ -118,7 +117,7 @@ public class FilteredBlockAndPartialMerkleTreeTests extends TestWithPeerGroup {
@Test(expected = VerificationException.class) @Test(expected = VerificationException.class)
public void merkleTreeMalleability() throws Exception { public void merkleTreeMalleability() throws Exception {
List<Sha256Hash> hashes = Lists.newArrayList(); List<Sha256Hash> hashes = new ArrayList<>();
for (byte i = 1; i <= 10; i++) hashes.add(numAsHash(i)); for (byte i = 1; i <= 10; i++) hashes.add(numAsHash(i));
hashes.add(numAsHash(9)); hashes.add(numAsHash(9));
hashes.add(numAsHash(10)); hashes.add(numAsHash(10));
@ -126,7 +125,7 @@ public class FilteredBlockAndPartialMerkleTreeTests extends TestWithPeerGroup {
Utils.setBitLE(includeBits, 9); Utils.setBitLE(includeBits, 9);
Utils.setBitLE(includeBits, 10); Utils.setBitLE(includeBits, 10);
PartialMerkleTree pmt = PartialMerkleTree.buildFromLeaves(UNITTEST, includeBits, hashes); PartialMerkleTree pmt = PartialMerkleTree.buildFromLeaves(UNITTEST, includeBits, hashes);
List<Sha256Hash> matchedHashes = Lists.newArrayList(); List<Sha256Hash> matchedHashes = new ArrayList<>();
pmt.getTxnHashAndMerkleRoot(matchedHashes); pmt.getTxnHashAndMerkleRoot(matchedHashes);
} }

View file

@ -795,7 +795,7 @@ public class PeerGroupTest extends TestWithPeerGroup {
assertNextMessageIs(p1, GetBlocksMessage.class); assertNextMessageIs(p1, GetBlocksMessage.class);
// Make some transactions and blocks that send money to the wallet thus using up all the keys. // Make some transactions and blocks that send money to the wallet thus using up all the keys.
List<Block> blocks = Lists.newArrayList(); List<Block> blocks = new ArrayList<>();
Coin expectedBalance = Coin.ZERO; Coin expectedBalance = Coin.ZERO;
Block prev = blockStore.getChainHead().getHeader(); Block prev = blockStore.getChainHead().getHeader();
for (ECKey key1 : keys) { for (ECKey key1 : keys) {

View file

@ -18,9 +18,9 @@
package org.bitcoinj.crypto; package org.bitcoinj.crypto;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.google.common.collect.Lists;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@ -67,7 +67,7 @@ public class MnemonicCodeTest {
@Test(expected = MnemonicException.MnemonicLengthException.class) @Test(expected = MnemonicException.MnemonicLengthException.class)
public void testEmptyMnemonic() throws Exception { public void testEmptyMnemonic() throws Exception {
List<String> words = Lists.newArrayList(); List<String> words = new ArrayList<>();
mc.check(words); mc.check(words);
} }

View file

@ -44,6 +44,7 @@ import org.bouncycastle.crypto.params.KeyParameter;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.security.SecureRandom; import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
@ -171,7 +172,7 @@ public class DeterministicKeyChainTest {
@Test @Test
public void events() throws Exception { public void events() throws Exception {
// Check that we get the right events at the right time. // Check that we get the right events at the right time.
final List<List<ECKey>> listenerKeys = Lists.newArrayList(); final List<List<ECKey>> listenerKeys = new ArrayList<>();
long secs = 1389353062L; long secs = 1389353062L;
chain = DeterministicKeyChain.builder().entropy(ENTROPY, secs).outputScriptType(Script.ScriptType.P2PKH) chain = DeterministicKeyChain.builder().entropy(ENTROPY, secs).outputScriptType(Script.ScriptType.P2PKH)
.build(); .build();

View file

@ -120,7 +120,7 @@ public class WalletTest extends TestWithWallet {
blockStore = new MemoryBlockStore(UNITTEST); blockStore = new MemoryBlockStore(UNITTEST);
chain = new BlockChain(UNITTEST, wallet, blockStore); chain = new BlockChain(UNITTEST, wallet, blockStore);
List<DeterministicKey> followingKeys = Lists.newArrayList(); List<DeterministicKey> followingKeys = new ArrayList<>();
for (int i = 0; i < numKeys - 1; i++) { for (int i = 0; i < numKeys - 1; i++) {
final DeterministicKeyChain keyChain = DeterministicKeyChain.builder().random(new SecureRandom()).build(); final DeterministicKeyChain keyChain = DeterministicKeyChain.builder().random(new SecureRandom()).build();
DeterministicKey partnerKey = DeterministicKey.deserializeB58(null, keyChain.getWatchingKey().serializePubB58(UNITTEST), UNITTEST); DeterministicKey partnerKey = DeterministicKey.deserializeB58(null, keyChain.getWatchingKey().serializePubB58(UNITTEST), UNITTEST);
@ -453,7 +453,7 @@ public class WalletTest extends TestWithWallet {
} }
private static void broadcastAndCommit(Wallet wallet, Transaction t) throws Exception { private static void broadcastAndCommit(Wallet wallet, Transaction t) throws Exception {
final LinkedList<Transaction> txns = Lists.newLinkedList(); final LinkedList<Transaction> txns = new LinkedList<>();
wallet.addCoinsSentEventListener(new WalletCoinsSentEventListener() { wallet.addCoinsSentEventListener(new WalletCoinsSentEventListener() {
@Override @Override
public void onCoinsSent(Wallet wallet, Transaction tx, Coin prevBalance, Coin newBalance) { public void onCoinsSent(Wallet wallet, Transaction tx, Coin prevBalance, Coin newBalance) {
@ -3324,7 +3324,7 @@ public class WalletTest extends TestWithWallet {
public void keyEvents() throws Exception { public void keyEvents() throws Exception {
// Check that we can register an event listener, generate some keys and the callbacks are invoked properly. // Check that we can register an event listener, generate some keys and the callbacks are invoked properly.
wallet = new Wallet(UNITTEST, KeyChainGroup.builder(UNITTEST).fromRandom(Script.ScriptType.P2PKH).build()); wallet = new Wallet(UNITTEST, KeyChainGroup.builder(UNITTEST).fromRandom(Script.ScriptType.P2PKH).build());
final List<ECKey> keys = Lists.newLinkedList(); final List<ECKey> keys = new LinkedList<>();
wallet.addKeyChainEventListener(Threading.SAME_THREAD, new KeyChainEventListener() { wallet.addKeyChainEventListener(Threading.SAME_THREAD, new KeyChainEventListener() {
@Override @Override
public void onKeysAdded(List<ECKey> k) { public void onKeysAdded(List<ECKey> k) {

View file

@ -25,7 +25,6 @@ import org.bitcoinj.core.PeerGroup;
import org.bitcoinj.net.discovery.DnsDiscovery; import org.bitcoinj.net.discovery.DnsDiscovery;
import org.bitcoinj.params.MainNetParams; import org.bitcoinj.params.MainNetParams;
import org.bitcoinj.utils.BriefLogFormatter; import org.bitcoinj.utils.BriefLogFormatter;
import com.google.common.collect.Lists;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
@ -37,6 +36,7 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -169,8 +169,8 @@ public class PeerMonitor {
public static final int PING_TIME = 4; public static final int PING_TIME = 4;
public static final int LAST_PING_TIME = 5; public static final int LAST_PING_TIME = 5;
public List<Peer> connectedPeers = Lists.newArrayList(); public List<Peer> connectedPeers = new ArrayList<>();
public List<Peer> pendingPeers = Lists.newArrayList(); public List<Peer> pendingPeers = new ArrayList<>();
public void updateFromPeerGroup() { public void updateFromPeerGroup() {
connectedPeers = peerGroup.getConnectedPeers(); connectedPeers = peerGroup.getConnectedPeers();

View file

@ -27,7 +27,6 @@ import org.bitcoinj.net.discovery.PeerDiscoveryException;
import org.bitcoinj.net.NioClientManager; import org.bitcoinj.net.NioClientManager;
import org.bitcoinj.params.MainNetParams; import org.bitcoinj.params.MainNetParams;
import org.bitcoinj.utils.BriefLogFormatter; import org.bitcoinj.utils.BriefLogFormatter;
import com.google.common.collect.Lists;
import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture; import com.google.common.util.concurrent.SettableFuture;
@ -78,7 +77,7 @@ public class PrintPeers {
final Object lock = new Object(); final Object lock = new Object();
final long[] bestHeight = new long[1]; final long[] bestHeight = new long[1];
List<ListenableFuture<Void>> futures = Lists.newArrayList(); List<ListenableFuture<Void>> futures = new ArrayList<>();
NioClientManager clientManager = new NioClientManager(); NioClientManager clientManager = new NioClientManager();
for (final InetAddress addr : addrs) { for (final InetAddress addr : addrs) {
InetSocketAddress address = new InetSocketAddress(addr, params.getPort()); InetSocketAddress address = new InetSocketAddress(addr, params.getPort());