Skip to content

Instantly share code, notes, and snippets.

@haarts
Created February 3, 2017 12:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haarts/deb48ae5c9c5b250e67be8154f766274 to your computer and use it in GitHub Desktop.
Save haarts/deb48ae5c9c5b250e67be8154f766274 to your computer and use it in GitHub Desktop.
Which Java Collection is used most often?
ArrayList 20870423
Stack 13799424
HashSet 3862284
Vector 3855212
LinkedList 2543036
TreeSet 589965
LinkedHashSet 366171
EnumSet 289934
LinkedBlockingQueue 207736
PriorityQueue 136294
CopyOnWriteArrayList 131798
AbstractList 111305
ArrayDeque 105329
AttributeList 100844
ConcurrentLinkedQueue 98684
AbstractSet 86274
ArrayBlockingQueue 74293
AbstractCollection 67280
SynchronousQueue 40350
CopyOnWriteArraySet 37628
RoleList 34158
AbstractQueue 25966
PriorityBlockingQueue 25256
LinkedBlockingDeque 24160
ConcurrentSkipListSet 13472
DelayQueue 12144
AbstractSequentialList 11496
ConcurrentHashMap.KeySetView 8862
LinkedTransferQueue 8383
ConcurrentLinkedDeque 6460
BeanContextSupport 4085
JobStateReasons 2569
RoleUnresolvedList 2196
BeanContextServicesSupport 1407
# http://gnuplot.sourceforge.net/demo_5.0/histograms.2.gnu
set terminal pngcairo font "arial,10" size 600,500
set xtics border in scale 0,0 nomirror rotate by -45 autojustify
set boxwidth 0.75
set style fill solid
set output 'barchart.png
plot "collections.dat" using 2:xtic(1) with boxes
#!/bin/bash -e
while read -r impl
do
echo $impl
curl -s "https://github.com/search?l=Java&q=$impl&ref=searchresults&type=Code&utf8=%E2%9C%93" \
-H 'Pragma: no-cache' \
-H 'DNT: 1' \
-H 'Accept-Encoding: gzip, deflate, sdch, br' \
-H 'Accept-Language: en-US,en;q=0.8,nl;q=0.6' \
-H 'Upgrade-Insecure-Requests: 1' \
-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/55.0.2883.87 Chrome/55.0.2883.87 Safari/537.36' \
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' \
-H 'Cache-Control: no-cache' \
-H 'Cookie: <YOU-REALLY-NEED-YOUR-OWN-AUTH-COOKIE-HERE' \
-H 'Connection: keep-alive' --compressed \
| ~/prj/go/bin/pup 'h3' | grep results | sed -e 's/[^0-9]*\([0-9,]\+\) .*/\1/g' | sed -e 's/,//g'
sleep 5
done <"collections.txt"
AbstractCollection
AbstractList
AbstractQueue
AbstractSequentialList
AbstractSet
ArrayBlockingQueue
ArrayDeque
ArrayList
AttributeList
BeanContextServicesSupport
BeanContextSupport
ConcurrentHashMap.KeySetView
ConcurrentLinkedDeque
ConcurrentLinkedQueue
ConcurrentSkipListSet
CopyOnWriteArrayList
CopyOnWriteArraySet
DelayQueue
EnumSet
HashSet
JobStateReasons
LinkedBlockingDeque
LinkedBlockingQueue
LinkedHashSet
LinkedList
LinkedTransferQueue
PriorityBlockingQueue
PriorityQueue
RoleList
RoleUnresolvedList
Stack
SynchronousQueue
TreeSet
Vector
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment