Return a list of containers which can potentially hold the boxes.

@param boxes      list of boxes
@param containers list of containers
@param count      maximum number of possible containers
@return list of containers
768361
private List<Container> filterByVolumeAndWeight(List<Box> boxes, List<Container> containers, int count) {
		long volume = 0;
		long minVolume = Long.MAX_VALUE;

		long weight = 0;
		long minWeight = Long.MAX_VALUE;

		for (Box box : boxes) {
			// volume
			long boxVolume = box.getVolume();
			volume += boxVolume;

			if (boxVolume < minVolume) {
				minVolume = boxVolume;
			}

			// weight
			long boxWeight = box.getWeight();
			weight += boxWeight;

			if (boxWeight < minWeight) {
				minWeight = boxWeight;
			}
		}

		long maxVolume = Long.MIN_VALUE;
		long maxWeight = Long.MIN_VALUE;

		for (Container container : containers) {
			// volume
			long boxVolume = container.getVolume();
			if (boxVolume > maxVolume) {
				maxVolume = boxVolume;
			}

			// weight
			long boxWeight = container.getWeight();
			if (boxWeight > maxWeight) {
				maxWeight = boxWeight;
			}
		}

		if (maxVolume * count < volume || maxWeight * count < weight) {
			// no containers will work at current count
			return Collections.emptyList();
		}

		List<Container> list = new ArrayList<>(containers.size());
		for (Container container : containers) {
			if (container.getVolume() < minVolume || container.getWeight() < minWeight) {
				// this box cannot even fit a single box
				continue;
			}

			if (container.getVolume() + maxVolume * (count - 1) < volume || container.getWeight() + maxWeight * (count - 1) < weight) {
				// this box cannot be used even together with all biggest boxes
				continue;
			}

			if (count == 1) {
				if (!canHoldAll(container, boxes)) {
					continue;
				}
			} else {
				if (!canHoldAtLeastOne(container, boxes)) {
					continue;
				}
			}

			list.add(container);
		}

		return list;
	}
407319
public Iterable<BoxItem.Info> getChildren(final String... fields) {
        return new Iterable<BoxItem.Info>() {
            @Override
            public Iterator<BoxItem.Info> iterator() {
                String queryString = new QueryStringBuilder().appendParam("fields", fields).toString();
                URL url = GET_ITEMS_URL.buildWithQuery(getAPI().getBaseURL(), queryString, getID());
                return new BoxItemIterator(getAPI(), url);
            }
        };
    }
294727
public void setContainers(java.util.Collection<ContainerStateChange> containers) {
        if (containers == null) {
            this.containers = null;
            return;
        }

        this.containers = new com.amazonaws.internal.SdkInternalList<ContainerStateChange>(containers);
    }
1274818
public static final <T> List<T> create(T... items)
    {
        List<T> list = new ArrayList<>();
        Collections.addAll(list, items);
        return list;
    }
929531
public static <T> List<T> repeatEachToSize(final Collection<T> c, final int size) {
        N.checkArgNotNegative(size, "size");
        checkArgument(size == 0 || notNullOrEmpty(c), "Collection can not be empty or null when size > 0");

        if (size == 0 || isNullOrEmpty(c)) {
            return new ArrayList<T>();
        }

        final int n = size / c.size();
        int mod = size % c.size();

        final List<T> result = new ArrayList<>(size);

        for (T e : c) {
            for (int i = 0, len = mod-- > 0 ? n + 1 : n; i < len; i++) {
                result.add(e);
            }

            if (result.size() == size) {
                break;
            }
        }

        return result;
    }
1318779
public void setContainers(java.util.Collection<ContainerDefinition> containers) {
        if (containers == null) {
            this.containers = null;
            return;
        }

        this.containers = new java.util.ArrayList<ContainerDefinition>(containers);
    }
320126
public String[] keys () {
        String[] keys = new String[count];
        for (int i = 0; i < count; ++i) {
            keys[i] = container[i].key;
        }
        return keys;
    }
216344
protected <T> List<List<T>> trivialPartition(List<T> objects, int minEntries, int maxEntries) {
    // build partitions
    final int size = objects.size();
    final int numberPartitions = (int) Math.ceil(((double) size) / maxEntries);
    List<List<T>> partitions = new ArrayList<>(numberPartitions);
    int start = 0;
    for(int pnum = 0; pnum < numberPartitions; pnum++) {
      int end = (int) ((pnum + 1.) * size / numberPartitions);
      if(pnum == numberPartitions - 1) {
        end = size;
      }
      assert ((end - start) >= minEntries && (end - start) <= maxEntries);
      partitions.add(objects.subList(start, end));
      start = end;
    }
    return partitions;
  }
372640
private List<INodeEntry> select(final int count, final Collection<INodeEntry> nodes) {
        List<INodeEntry> source = new ArrayList<>(nodes);
        List<INodeEntry> selected = new ArrayList<>();
        int total = Math.min(count, nodes.size());
        for (int i = 0; i < total; i++) {
            selected.add(source.remove(random.nextInt(source.size())));
        }
        return selected;
    }
1044761
public static IElectronContainer[] getElectronContainerArray(List<IElectronContainer> list) {
        IElectronContainer[] ret = new IElectronContainer[list.size()];
        for (int i = 0; i < ret.length; ++i)
            ret[i] = list.get(i);
        return ret;
    }
382971
<T> IClassContainer buildClassContainer(final List<T> list) {
        return (BasicCollectionUtils.isNotEmpty(list))
                ? buildClassContainer(list.get(0))
                : null;
    }
531297
@Nonnull
    public static <T> List<T> join(@Nonnull Collection<? extends T>... items) {
        int size = 0;
        for (Collection<? extends T> item : items)
            size += item.size();
        List<T> r = new ArrayList<>(size);
        for (Collection<? extends T> item : items)
            r.addAll(item);
        return r;
    }
115403
public <T> List<T> randomElements(List<T> elements, int count) {
		if (elements.size() >= count) {
			return extractRandomList(elements, count);
		} else {
			List<T> randomElements = new ArrayList<T>();
			randomElements.addAll(extractRandomList(elements, count % elements.size()));
			do {
				randomElements.addAll(extractRandomList(elements, elements.size()));
			} while (randomElements.size() < count);
			return randomElements;
		}
	}
169850
public Object[] extractValueArray(ValueContainer[] containers)
    {
        Object[] result = new Object[containers.length];
        for(int i = 0; i < containers.length; i++)
        {
            result[i] = containers[i].getValue();
        }
        return result;
    }
759125
public Arr array(File[] files, int start, int count) {
		return Arr.fromList(list(files, start, count));
	}
458487
public static int getNumContainers(TopologyAPI.Topology topology) {
    List<TopologyAPI.Config.KeyValue> topologyConfig = topology.getTopologyConfig().getKvsList();
    return Integer.parseInt(TopologyUtils.getConfigWithDefault(
        topologyConfig, Config.TOPOLOGY_STMGRS, "1").trim());
  }
333560
private List<String> findVolumesFromContainers(List<String> images) throws DockerAccessException {
        List<String> list = new ArrayList<>();
        if (images != null) {
            for (String image : images) {
                String id = findContainerId(image, true);
                if (id == null) {
                    throw new DockerAccessException("No container found for image/alias '%s', unable to mount volumes", image);
                }

                list.add(queryService.getContainerName(id));
            }
        }
        return list;
    }