@Test public void filterForNonZero() throws Exception { Map<String, BigDecimal> funds = new HashMap<>(); funds.put("BTC", BigDecimal.ZERO); funds.put("LTC", new BigDecimal("1")); funds.put("ZEC", new BigDecimal("0.0")); funds.put("ETH", new BigDecimal("0")); funds.put("NVC", new BigDecimal("0.00")); funds.put("PPC", new BigDecimal("0.000000000001")); Map<String, BigDecimal> filtered = PairUtils.filterForNonZero(funds); assertEquals(2, filtered.size()); assertEquals(1, filtered.get("LTC").intValue()); assertTrue(filtered.containsKey("PPC")); }
@NonNull public static Map<String, BigDecimal> filterForNonZero( @NonNull Map<String, BigDecimal> funds) { Map<String, BigDecimal> output = new HashMap<>(); for (Map.Entry<String, BigDecimal> entry : funds.entrySet()) { if (entry.getValue().doubleValue() != 0) { output.put(entry.getKey(), entry.getValue()); } } return output; }
PairUtils { @NonNull public static Map<String, BigDecimal> filterForNonZero( @NonNull Map<String, BigDecimal> funds) { Map<String, BigDecimal> output = new HashMap<>(); for (Map.Entry<String, BigDecimal> entry : funds.entrySet()) { if (entry.getValue().doubleValue() != 0) { output.put(entry.getKey(), entry.getValue()); } } return output; } }
PairUtils { @NonNull public static Map<String, BigDecimal> filterForNonZero( @NonNull Map<String, BigDecimal> funds) { Map<String, BigDecimal> output = new HashMap<>(); for (Map.Entry<String, BigDecimal> entry : funds.entrySet()) { if (entry.getValue().doubleValue() != 0) { output.put(entry.getKey(), entry.getValue()); } } return output; } private  PairUtils(); }
PairUtils { @NonNull public static Map<String, BigDecimal> filterForNonZero( @NonNull Map<String, BigDecimal> funds) { Map<String, BigDecimal> output = new HashMap<>(); for (Map.Entry<String, BigDecimal> entry : funds.entrySet()) { if (entry.getValue().doubleValue() != 0) { output.put(entry.getKey(), entry.getValue()); } } return output; } private  PairUtils(); @NonNull static String localToServer(@NonNull String pair); @NonNull static String serverToLocal(@NonNull String pair); static boolean isSupportedPair(@NonNull Context context, @NonNull String pair); @NonNull static Set<String> exchangePairs(@NonNull ExchangeInfo exchangeInfo); @NonNull static Map<String, BigDecimal> filterForNonZero(
            @NonNull Map<String, BigDecimal> funds); }
PairUtils { @NonNull public static Map<String, BigDecimal> filterForNonZero( @NonNull Map<String, BigDecimal> funds) { Map<String, BigDecimal> output = new HashMap<>(); for (Map.Entry<String, BigDecimal> entry : funds.entrySet()) { if (entry.getValue().doubleValue() != 0) { output.put(entry.getKey(), entry.getValue()); } } return output; } private  PairUtils(); @NonNull static String localToServer(@NonNull String pair); @NonNull static String serverToLocal(@NonNull String pair); static boolean isSupportedPair(@NonNull Context context, @NonNull String pair); @NonNull static Set<String> exchangePairs(@NonNull ExchangeInfo exchangeInfo); @NonNull static Map<String, BigDecimal> filterForNonZero(
            @NonNull Map<String, BigDecimal> funds); static final Comparator<String> CURRENCY_COMPARATOR; }