List of usage examples for org.apache.commons.lang3 ArrayUtils removeAllOccurences
public static <T> T[] removeAllOccurences(final T[] array, final T element)
Removes the occurrences of the specified element from the specified array.
From source file:com.codebutler.farebot.transit.myway.MyWayTagRecord.java
public MyWayTagRecord(byte[] record) { byte[] ts = Utils.reverseBuffer(record, 3, 4); mTimestamp = Utils.byteArrayToInt(ts); mTagOn = record[7] == 0x10;/* w w w . ja v a 2s .co m*/ byte[] route = Arrays.copyOfRange(record, 8, 4 + 8); route = ArrayUtils.removeAllOccurences(route, (byte) 0x00); mRoute = new String(route); byte[] cost = Utils.reverseBuffer(record, 13, 2); mCost = Utils.byteArrayToInt(cost); }
From source file:org.ligoj.app.plugin.prov.aws.in.ProvAwsPriceImportResource.java
/** * Install a new EC2 instance type/* w ww . jav a2s . co m*/ */ private ProvInstanceType installInstanceType(final UpdateContext context, final AwsEc2Price csv) { final ProvInstanceType type = context.getInstanceTypes().computeIfAbsent(csv.getInstanceType(), k -> { final ProvInstanceType t = new ProvInstanceType(); t.setNode(context.getNode()); t.setCpu(csv.getCpu()); t.setName(csv.getInstanceType()); // Convert GiB to MiB, and rounded final String memoryStr = StringUtils.removeEndIgnoreCase(csv.getMemory(), " GiB").replace(",", ""); t.setRam((int) Math.round(Double.parseDouble(memoryStr) * 1024d)); t.setConstant(!"Variable".equals(csv.getEcu())); return t; }); // Update the statistics only once if (context.getInstanceTypesMerged().add(type.getName())) { type.setDescription(ArrayUtils.toString(ArrayUtils .removeAllOccurences(new String[] { csv.getPhysicalProcessor(), csv.getClockSpeed() }, null))); // Rating type.setCpuRate(getRate("cpu", csv)); type.setRamRate(getRate("ram", csv)); type.setNetworkRate(getRate("network", csv, csv.getNetworkPerformance())); type.setStorageRate(toStorage(csv)); // Need this update itRepository.saveAndFlush(type); } return type; }