• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

Not the sum, but the average!

 
Saloon Keeper
Posts: 4350
163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In this topic (ArrayList-Table-Sum) two methods were given to determine the sum per state.
But to judge what state performed best, it is more honest to determine the average time per state. Can you do that a) by modifying Campbells method and b) by using another method than map.merge? (It should still be a one-liner).
 
Bartender
Posts: 331
42
Firefox Browser MySQL Database Java Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You mean like this?
(I have never been sure how to indent these properly)
 
Piet Souris
Saloon Keeper
Posts: 4350
163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi JJ,

yes, that is it. My style is like yours, only I use static imports as much as I can to reduce typing and to make the code a bit shorter. So I would write:

Have you thought about part b?
 
Hey cool! They got a blimp! But I have a tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic