Skip to content

Instantly share code, notes, and snippets.

View kaspernielsen's full-sized avatar

Kasper Nielsen kaspernielsen

View GitHub Profile
List&lt;Person&gt; <span class="nt">personsUnder50Years</span> = map.values().filter(new Predicate<Person>() {
public boolean accept(Person element) {return element.age < 50;}
}).toList();
@kaspernielsen
kaspernielsen / QueryExample.java
Created August 8, 2012 15:42
Cake Query Example
package org.cakeframework.internal.view.compiled.test;
import org.cakeframework.internal.view.AbstractViewNode;
import org.cakeframework.internal.view.compiled.test.Data;
import org.cakeframework.internal.view.spi.ViewProcessor;
import org.cakeframework.internal.view.util.ViewErrorMessages;
import org.cakeframework.util.concurrent.ThreadLocalMersenneTwisterRandom;
import org.cakeframework.util.functions.Predicate;
public class FilterOnTypeFilterNullsFilterOnTypeOrderFilterShuffleTailNoBase implements ViewProcessor {
@kaspernielsen
kaspernielsen / Tester.java
Created August 8, 2012 16:27
Cake getting started
import java.util.Arrays;
import org.cakeframework.big.map.BigMap;
import org.cakeframework.big.map.BigMapConfiguration;
/**
*
* @author Kasper Nielsen
*/
public class Tester {
/*
* Copyright (c) 2008 Kasper Nielsen.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
<settings>
<localRepository/>
<interactiveMode/>
<usePluginRegistry/>
<offline/>
<pluginGroups/>
<servers>
<server>
<id>sonatype-nexus-snapshots</id>
<username>${env.CI_DEPLOY_USERNAME}</username>
<settings>
<localRepository/>
<interactiveMode/>
<usePluginRegistry/>
<offline/>
<pluginGroups/>
<servers>
<server>
<id>sonatype-nexus-snapshots</id>
<username>${env.CI_DEPLOY_USERNAME}</username>
<settings>
<localRepository/>
<interactiveMode/>
<usePluginRegistry/>
<offline/>
<pluginGroups/>
<servers>
<server>
<id>ossrh</id>
<username>${env.CI_DEPLOY_USERNAME}</username>

Keybase proof

I hereby claim:

  • I am kaspernielsen on github.
  • I am kasperni (https://keybase.io/kasperni) on keybase.
  • I have a public key ASCULnwiofvbZK-cx5ChdWzpmzkmtqaoWNv9HZLchkuIxgo

To claim this, I am signing this object:

public static String toString(int[] a) {
int iMax = a.length - 1;
if (iMax == -1)
return "[]";
int size = 2 * a.length;
for (int j = 0; j < a.length; j++) {
size += stringSize(a[j]);
}
/**
* Lazily associate a computed value with a lookup object much like {@link ClassValue} but for {@link Lookup} objects.
*/
public abstract class LookupValue<T> {
/** The cache of values. */
private final ClassValue<ConcurrentHashMap<Integer, T>> LOOKUP_CACHE = new ClassValue<>() {
/** {@inheritDoc} */
@Override