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
@SuppressWarnings("unchecked") | |
private static <T,U> Map<U, List<T>> formatMapClefEnsembleValeursAvecOuSansLimitateur(List<Map<String, Object>> liste, | |
String identifiant, String valeur, Integer limitation) { | |
final Map<U, List<T>> mapKeyValue = new HashMap<U, List<T>>(); | |
final Map<U, Integer> mapLimitation = new HashMap<U, Integer>(); | |
if (!isEmpty(liste)) { | |
final boolean ligneComplete = StrUtil.isEmpty(valeur); | |
for (final Map<String, ?> map : liste) { | |
final U key = (U) map.get(identifiant); |
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
// The ultimate Eclipse guide. Should work after 10-15 iterations | |
while (!working) { | |
try { | |
servers.clean(); | |
servers.deleteAll(); | |
project.clean(); | |
maven.clean(); | |
eclipse.restart(); | |
maven.install(); |
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
// ... | |
app.get(libRoot + '/get/:start/:count', function(req, res) { | |
getSongsPage([/*some data*/], req.params.start, req.params.count); | |
// ... | |
}); | |
// ... | |
function getSongsPage(allSongs: SongInfo[], start: number, count: number): SongInfo[] { |
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
// File Controller.js | |
function search(str) { | |
var layers = getAllActiveLayers(); | |
layers.forEach(function(layer) { | |
layer.search(str); | |
}); | |
} | |
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
// Layer interface | |
interface Layer { | |
search: (str: string)=>void; | |
} | |
// File Controller.js | |
function search(str) { | |
var layers: Layer[] = getAllActiveLayers(); | |
layers.forEach(function(layer) { | |
layer.search(str); |
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 Persister { | |
public Collection<Voiture> query(String q) { | |
// get from DB | |
} | |
} | |
public class Voiture { | |
private final int couleur; | |
public Voiture(int couleur) { |
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 cat; | |
import static com.mysema.query.alias.Alias.$; | |
import static com.mysema.query.alias.Alias.alias; | |
import static com.mysema.query.collections.CollQueryFactory.from; | |
import java.util.ArrayList; | |
import java.util.Collection; | |
import com.google.common.base.Optional; |
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
var i = 0; | |
var async = function() { | |
return new Promise(function(resolve, reject) { | |
setTimeout(function() { | |
resolve(i++); | |
}, 500); | |
}); | |
}; | |
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
// Check out Uniqueness API: https://github.com/jotak/jmisc/tree/master/jotak-misc/src/main/java/com/jotak/misc/collection | |
// Build a collection with removed duplicates on a custom criteria, regardless the "equals" and "hashCode" of the data object | |
// Here we build a "unique key" based on Something::getField1 | |
final List<Something> allFields = Uniqueness.from(inputList) | |
.constraintOn(ImmutableList.of(Something::getField1)) | |
.asList(); | |
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.Optional; | |
import java.util.function.Consumer; | |
/** | |
* @author jtakvorian | |
*/ | |
public final class Optionals { | |
private Optionals() { | |
} |
OlderNewer