private static List<Double> generatePoints(int maxPoints, int rounding, Map<String, Object> attributes) { Number start = Utilities.getCasted(attributes, RANGE_START, Number.class); Number end = Utilities.getCasted(attributes, RANGE_END, Number.class); Number increment = Utilities.getCasted(attributes, RANGE_INCREMENT, Number.class); if (!areNumbersValid(start, end, increment)) { return Collections.emptyList(); } Double from = start.doubleValue(); Double to = end.doubleValue(); Double by = increment.doubleValue(); List<Double> points = new ArrayList<>(); for (int i = 0; i < maxPoints && from <= to; ++i) { points.add(Utilities.round(from, rounding)); from += by; } return points; }