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
package com.ajira.chocosolver; | |
import org.chocosolver.solver.Model; | |
import org.chocosolver.solver.Solution; | |
import org.chocosolver.solver.search.loop.monitors.CPProfiler; | |
import org.chocosolver.solver.variables.IntVar; | |
import org.chocosolver.solver.variables.Variable; | |
import java.io.IOException; | |
import java.util.Arrays; |
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
/** | |
* Java code from https://gist.github.com/patloew/bc32a2a1a3c0097e9c7020192fb2c78f | |
* used and converted to Kotlin with some modifications | |
*/ | |
open class RealmListParcelConverter<T> : TypeRangeParcelConverter<RealmList<T>, RealmList<T>> where T : io.realm.RealmObject{ | |
override fun toParcel(input: RealmList<T>?, parcel: Parcel) { | |
if (input == null) { | |
parcel.writeInt(NULL) |
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
module LangtonsAnt | |
type Direction = Up | Down | Left | Right | |
type CellColor = Black | White | |
type Cell = {Row: int; Column: int; Color: CellColor; Ant: Ant option} | |
and Ant = {Cell: Cell; Direction: Direction} | |
type Plane = {Cells: Cell[][]} |
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
# Path to your oh-my-zsh installation. | |
export ZSH=/Users/raam/.oh-my-zsh | |
# Set name of the theme to load. | |
# Look in ~/.oh-my-zsh/themes/ | |
# Optionally, if you set this to "random", it'll load a random theme each | |
# time that oh-my-zsh is loaded. | |
ZSH_THEME="random" | |
# Uncomment the following line to use case-sensitive completion. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
package in.raam.lazy; | |
import java.util.ArrayList; | |
import java.util.List; | |
class Parent { | |
private String key; | |
private Lazy<List<Child>> children = Lazy.create(() -> new ParentHelper().loadChildren(this)); | |
public Lazy<List<AnotherChild>> childList = Lazy.create(this::loadChildList); |
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
package in.raam.lazy; | |
import static org.junit.Assert.assertEquals; | |
import static org.junit.Assert.assertFalse; | |
import static org.junit.Assert.assertNotEquals; | |
import static org.junit.Assert.assertTrue; | |
import java.util.Random; | |
import java.util.concurrent.ExecutionException; | |
import java.util.concurrent.ScheduledThreadPoolExecutor; |
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
package in.raam.lazy; | |
class IntensiveResource { | |
public IntensiveResource() { | |
// e.g. | |
// obtain a JNDI object may be a datasource or remote objects | |
// load values from file | |
// create datasource manually | |
// load a huge set of children objects for a parent collection | |
System.out.println("Wait! performing CPU intensive operations..."); |
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
package in.raam.lazy; | |
import java.io.Serializable; | |
import java.util.Optional; | |
import java.util.concurrent.atomic.AtomicBoolean; | |
import java.util.concurrent.atomic.AtomicReference; | |
import java.util.concurrent.locks.ReentrantLock; | |
import java.util.function.Supplier; | |
/** |
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
package nqueens; | |
import java.util.*; | |
import nqueens.Tree.Leaf; | |
import nqueens.Tree.Node; | |
public class NQueensTree { | |
static class Count { |
NewerOlder