class POJO { private Collection<X> col = new SomeCollection<X>(); public Collection<X> getCol() { return col; } }
require.config({...}) // Configure requires.js... require(["jquery", "cs!models/samplemodel", "cs!views/sampleview","cs!collections/samplecollection"], function ($, Model, View, Collection) { var collection = new Collection(); collection.fetch(); var view = new View({collection: collection}); $("body").html(view.render().$el); })
return new Collection(); this._innerList = []; this._xref = {};
Items=new Collection("items"); for(var i=0;i<10;i++){ Items.insert({ text:"Item "+i, color1:"#"+Random.hexString(6), color2:"#"+Random.hexString(6), gradient:Random.choice([false,true]) }); }
var Collection = Backbone.Collection.extend({ parse: function (resp) { return resp.bar; } }); var collection = new Collection(); collection.fetch({ url: "http://localhost/api/somecollection" });
public Object Clone() { Collection rv = new Collection(); for (ElementInterface element : elementArray) { rv.Add(element.clone()); } return rv; }
var collection = new Collection(), result = collection.get(1); result.deferred.done(function() { console.log(result.model); });
var myArray = new Collection(); myArray.push(1); myArray.color();
<Routes> <Route handler={App}> <Route name="list" handler={ListComponent} collection={new Collection()}> <Route name="listDetails" path="/list/:id" handler={DetailsComponent}/> </Route> </Route> </Routes>
var Collection = Backbone.Collection.extend({}) var exported if ( isNode ) { module.exports.init = function(session) { session.collection = new Collection() exported = session.collection } } else { exported = new Collection() } module.exports.collection = exported
Collection<Document> cd = new Document(); cd = cd.getNewInstance();
Collection.prototype.onOpen(); // `this` refers to `Collection.prototype` // vs var c = new Collection(); c.onOpen(); // `this` refers to `c` // vs var o = {}; Collection.prototype.onOpen.call(o); // `this` refers to `o` // vs var foo = Collection.prototype.onOpen; foo(); // `this` could be `window` or undefined
var ViewOne = Backbone.View.extend({ initialize: function () { var collection = new Collection(); collection.fetch({ success:function(){ new ViewTwo({ collection: collection }); } }); } });
public Collection<Doctor> getDoctors() { Collection<Doctor> result = new ArrayList<>(doctors.size()); for (HospitalToDoctor hospitalToDoctor : doctors) { result.add(hospitalToDoctor.getDoctor()); } return result; }
var ViewOne = Backbone.View.extend({ initialize: function () { var collection = new Collection(); collection.fetch(); new ViewTwo({ collection: collection }); } });
// works with collections and arrays, everything // that has an iterator Collection<Object> c = new Collection<Object>(); for (Object i : c) { // do code }
Collection<Character> vowels = new HasSet<~>(); vowels.add('a'); vowels.add('e'); vowels.add('i'); vowels.add('o'); vowels.add('u');
Collection<Callable<YourResults>> tasks = new List<>(inputs.size()); for (YourInput i : inputs) tasks.add(new YourTask(i)); ExecutorService workers = Executors.newFixedThreadPool(10); /* The next call blocks while the worker threads complete all tasks. */ List<Future<YourResult>> results = workers.invokeAll(tasks); workers.shutdown(); for (Future<YourResult> f : results) { YourResult r = f.get(); /* Do whatever it is you do with the results. */ ... }
var foo = new Foo({id : 1}) var c = new Collection(); c.add(foo) c.length === 1; // => true foo === c[0]; // => true foo === c.find(1); // => true
public Collection<Point> scaleShape(float scale, Collection<Point> shape) { Point centroid = getCentroid(); Collection<Point> scaledShape = new ArrayList<>(shape.size()); for (Point point : shape) { Point diff = new Point(point.x() - centroid.x(), point.y() - centroid.y()); Point scaledPoint = new Point( (int) (centroid.x() + scale * diff.x()), (int) (centroid.y() + scale * diff.y())); scaledShape.add(scaledPoint); } return scaledShape; }