All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.stagemonitor.util.CollectionUtils Maven / Gradle / Ivy

There is a newer version: 1.50.0
Show newest version
package org.stagemonitor.util;

import java.util.List;

public final class CollectionUtils {

	public static  int getIndexOf(List configurationSources, Class clazz) {
		int i = 0;
		for (; i < configurationSources.size(); i++) {
			if (clazz.isInstance(configurationSources.get(i))) {
				return i;
			}
		}
		return -1;
	}

	public static  void addAfter(List list, Class clazz, T toInsert) {
		list.add(getIndexOf(list, clazz) + 1, toInsert);
	}

	public static int getMapCapacityForExpectedSize(int expectedSize) {
		return (int) Math.ceil(expectedSize / 0.75);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy