Skip to content

Instantly share code, notes, and snippets.

@zhangsida
zhangsida / scratch_121.txt
Created May 15, 2019 07:33 — forked from ibalashov/scratch_121.txt
List vs HashSet performance for small lists (single contains op)
public static List<Integer> generate(int series) {
return Stream.iterate(new int[]{0, 1}, s -> new int[]{s[1], s[0] + s[1]})
.limit(series)
.map(n -> n[0])
.collect(Collectors.toList());
}
public static void main(String[] args) {
generate(30).forEach(n -> {
List<String> collected = Stream.generate(() -> UUID.randomUUID().toString()).limit(n).collect(Collectors.toList());
Methode 1
<p:dataTable var="entry" value="#{hashMap.entrySet().toArray()}">
<p:column headerText="key">
<h:outputText value="${entry.key}" />
</p:column>
<p:column headerText="value id">
<h:outputText value="${entry.value.id}" />
</p:column>
</p:dataTable>
@zhangsida
zhangsida / jquery toggle function
Created November 26, 2013 22:15
switch between two <P>-element with jquery and css
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("p").toggle();
});
@zhangsida
zhangsida / JavaScript Highlight
Last active December 29, 2015 10:19
the things to be know about this code are in the comment
<!DOCTYPE HTML>
<html>
<head>
<meta http - equiv = "Content-Type" content = "text/html; charset=utf-8" >
<title>Highstock Example </title>
<script type = "text/javascript" src = "http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" > </script>
<script type = "text/javascript" >
$(function () {
$.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=range.json&callback=?', function (data) {
$('#container').highcharts('StockChart', {