Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

10
LINES

< > TinyBrain | #1013644 - multiSetTopTenAsLinkedHashMap

JavaX fragment (include)

static <A> LinkedHashMap<A, Int> multiSetTopTenAsLinkedHashMap(MultiSet<A> ms) {
  ret multiSetTopTenAsLinkedHashMap(ms, 10);
}

static <A> LinkedHashMap<A, Int> multiSetTopTenAsLinkedHashMap(MultiSet<A> ms, int n) {
  new LinkedHashMap<A, Int> map;
  for (A a : ms.getTopTen(n))
    map.put(a, ms.get(a));
  ret map;
}

Author comment

Began life as a copy of #1013507

download  show line numbers  debug dex   

Travelled to 2 computer(s): cfunsshuasjs, tvejysmllsmz

No comments. add comment

Snippet ID: #1013644
Snippet name: multiSetTopTenAsLinkedHashMap
Eternal ID of this version: #1013644/1
Text MD5: a942dd19a087156440d91d1aba2fd5c0
Author: stefan
Category: javax / collections
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-01-12 12:33:28
Source code size: 328 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 5 / 5
Referenced in: [show]