switchConnectionHandler.setErrorHandler(errorHandler);
switchConnectionHandler.init();
-
- List<ListenableFuture<Boolean>> starterChain = new ArrayList<>();
+
+ List<ListenableFuture<Boolean>> starterChain = new ArrayList<>(switchConnectionProviders.size());
for (SwitchConnectionProvider switchConnectionPrv : switchConnectionProviders) {
switchConnectionPrv.setSwitchConnectionHandler(switchConnectionHandler);
ListenableFuture<Boolean> isOnlineFuture = switchConnectionPrv.startup();
*/
public void stop() {
LOG.debug("stopping");
- List<ListenableFuture<Boolean>> stopChain = new ArrayList<>();
+ List<ListenableFuture<Boolean>> stopChain = new ArrayList<>(switchConnectionProviders.size());
try {
for (SwitchConnectionProvider switchConnectionPrv : switchConnectionProviders) {
ListenableFuture<Boolean> shutdown = switchConnectionPrv.shutdown();
package org.opendaylight.openflowplugin.openflow.md.core;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.HelloElementType;
public static HelloInput createHelloInput(short helloVersion, long helloXid, List<Short> versionOrder) {
HelloInputBuilder helloInputbuilder = prepareHelloInputBuilder(helloVersion, helloXid);
if (versionOrder != null) {
- List<Elements> elementList = new ArrayList<>();
ElementsBuilder elementsBuilder = new ElementsBuilder();
elementsBuilder.setType(HelloElementType.VERSIONBITMAP);
- List<Boolean> booleanList = new ArrayList<>();
+ int resultVersionListSize = 0;
+ if (!versionOrder.isEmpty()) {
+ resultVersionListSize = versionOrder.get(0) + 1;
+ }
+ List<Boolean> booleanList = new ArrayList<>(resultVersionListSize);
int versionOrderIndex = versionOrder.size() - 1;
}
elementsBuilder.setVersionBitmap(booleanList);
- elementList.add(elementsBuilder.build());
+
+ List<Elements> elementList = Collections.singletonList(elementsBuilder.build());
helloInputbuilder.setElements(elementList);
}
return helloInputbuilder.build();
*/
package org.opendaylight.openflowplugin.openflow.md.lldp;
-import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Timer;
.setValue(customValue);
// Create LLDP Custom Option list
- List<LLDPTLV> customList = new ArrayList<LLDPTLV>();
- customList.add(customTlv);
+ List<LLDPTLV> customList = Collections.singletonList(customTlv);
// Create discovery pkt
LLDP discoveryPkt = new LLDP();
* @see {@link MacAddress}
*/
public static String macAddressToString(byte[] address) {
- List<String> groups = new ArrayList<>();
+ List<String> groups = new ArrayList<>(MAC_ADDRESS_LENGTH);
for(int i=0; i < MAC_ADDRESS_LENGTH; i++){
groups.add(String.format("%02X", address[i]));
}