Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

{
"addresses": [{
"line1": "123 Fake street",
"line2": null,
"city": "Oakland",
"state": "CA",
"zip": "94602"
}, {
"line1": "517 Montauk Hwy",
"line2": null,
import React from 'react-native'
import Swiper from 'react-native-swiper'
import randomcolor from 'randomcolor'
const {
View,
Text,
StyleSheet
} = React
import React from 'react-native'
var {
Image,
Animated,
View
} = React
module.exports = React.createClass({
getInitialState() {
import React from 'react-native'
var {
Image,
Animated,
View
} = React
module.exports = React.createClass({
getInitialState() {
module.exports = React.createClass({
displayName: 'ImageTester',
getInitialState() {
return {
showImage: false
};
},
render() {
def getCounts[T](list: Seq[T]): Map[T, Int] = list.foldLeft(Map.empty[T, Int]) { (m: Map[T, Int], x: T) => m + ((x, m.getOrElse(x, 0) + 1)) }
import scala.collection.mutable.Map;
def getCounts[T](list: Seq[T]): Map[T, Int] = {
val map = Map.empty[T, Int];
list.foreach(x => {
if (!map.contains(x)) {
map.put(x, 0);
}
map.put(x, map(x) + 1);
});
return map;
def getCounts[T](list: Seq[T]): Map[T, Int] = {
list.foldLeft(Map.empty[T, Int]) { (m: Map[T, Int], x: T) => m + ((x, m.getOrElse(x, 0) + 1)) }
}
public static <T> Map<T, Integer> getCounts(List<T> list) {
Map<T, Integer> counts = new HashMap<T, Integer>();
for(T item : list) {
if(!counts.containsKey(item)) {
counts.put(item, 0);
}
counts.put(item, counts.get(item) + 1);
}
return counts;
}
<div class="gist">https://gist.github.com/6968489</div>