This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LinkedList<T> implements Iterable<T> | |
{ | |
public LinkedNode<T> head = new LinkedNode<T>( this ); | |
private int size = 0; | |
public final LinkedNode<T> add( T value ) | |
{ | |
return new LinkedNode<T>( value ).prepend( head ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Prime | |
{ | |
/* BEGIN TEST */ | |
public static void main( String[] args ) | |
{ | |
Prime p = new Prime( 100000 ); | |
// Load 100,000 primes into cache | |
long t0 = System.nanoTime(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface Reflect<T> | |
{ | |
public T get(ByteBuffer in); | |
public void getAndSet(ByteBuffer in, Object obj, Field field) throws IllegalAccessException; | |
public void put(ByteBuffer out, T v); | |
public int sizeOf(T v); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.nio.ByteBuffer; | |
public class Compress | |
{ | |
public static final int BYTE_MORE = 0x80; | |
public static final int BYTE_SIGN = 0x40; | |
public static final int BYTE_NULL = 0x20; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.BasicStroke; | |
import java.awt.Color; | |
import java.awt.Graphics2D; | |
import java.awt.Stroke; | |
import java.awt.event.KeyEvent; | |
import java.awt.geom.Ellipse2D; | |
import java.awt.geom.Line2D; | |
import java.awt.geom.Path2D; | |
import java.awt.geom.Rectangle2D; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.Color; | |
import java.awt.Font; | |
import java.awt.Graphics2D; | |
import java.awt.event.KeyEvent; | |
import java.awt.geom.Ellipse2D; | |
import java.awt.geom.Line2D; | |
import java.util.Arrays; | |
import java.util.List; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.Color; | |
import java.awt.Font; | |
import java.awt.Graphics; | |
import java.awt.Graphics2D; | |
import java.awt.RenderingHints; | |
import java.awt.event.MouseEvent; | |
import java.awt.geom.Ellipse2D; | |
import java.awt.geom.Line2D; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Wikipedia | |
{ | |
public static class Article implements Serializable { | |
private static final long serialVersionUID = 1L; | |
public int id; | |
public String title; | |
public Set<String> related = new HashSet<String>(); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class StringTemplate | |
{ | |
public static final String DEFAULT_START = "{"; | |
public static final String DEFAULT_END = "}"; | |
private String[] chunks; | |
public StringTemplate( String text ) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Elongate | |
{ | |
public static void main( String[] args ) | |
{ | |
Scanner in = new Scanner( System.in ); | |
StringBuilder code = new StringBuilder(); | |
while (in.hasNextLine()) |