I found it in the map api for java... neverless I decided to use this function:
double total = 0;
for (Double value : voltages.values()) {
total = total + value;
Is there a...
Type: Posts; User: akerman
I found it in the map api for java... neverless I decided to use this function:
double total = 0;
for (Double value : voltages.values()) {
total = total + value;
Is there a...
Well this is the example I found which might be useful but I wasn't able to adapt it:
// Compute sum of salaries by department
Map<Department, Integer> totalByDept = employees.stream()...
.collect(Collectors.groupingBy(Employee::getDepartment,
Collectors.summingInt(Employee::getSalary)));
I was trying to use above example get the sum but I was not able to adapt it so it would work...
I have seen a loop what it firstly takes the size and then calculates the sum. But I know there is an easier way using for loop... but could find an example which would help me.
Hi there;
Just a simple question which has caused me problems.
I created hashtable:
private Map <String, Double> v = new ConcurrentHashMap<String, Double>();