collections Questions

3

Solved

I have a Collection, I'm trying to use the Distinct method to remove duplicates. public static Collection<MediaInfo> imagePlaylist imagePlaylist = imagePlaylist.Distinct(new API.MediaInfoCo...
Gwen asked 30/12, 2011 at 5:15

3

I am creating passport authentication for node using mongoose. I don't have any collection called "users" in my database. But while creating new user using the schema like below var mongoose = req...
Jerricajerrie asked 20/8, 2014 at 12:53

4

I have a widget(which works) with a GridView, which shows information in 1 or more columns/rows. I want to set the number of columns programmatically, cause the users shall choose. If I set the num...
Byrom asked 5/12, 2012 at 14:50

4

Solved

I just want to know for what java.util.Collections.checkedList() is actually used. I have some code that I know is returning me a List<String> but it's being passed through a chain of messa...
Pili asked 21/7, 2009 at 19:17

3

Solved

I'm looking for a method that consumes a Vec and returns one element, without the overhead of restoring Vec's invariants the way remove and swap_remove do: fn take<T>(vec: Vec<T>, inde...
Functional asked 21/8, 2017 at 19:2

10

Solved

I already know how to do it the hard way and got it working - iterating over entries and swapping "manually". But i wonder if, like so many tasks, this one can be solved in a more elegant way. I h...
Expositor asked 14/12, 2010 at 7:55

5

Solved

I want to be able to (pretty-)print the contents of my maps. They should have newlines and indentation rather than on a single line; ignoring the toString methods of collections/iterables/etc; and...
Incitement asked 2/3, 2013 at 6:50

4

Solved

i have to find out whether or not two collections have any intersection, the way that i did that is using LINQ's "Join" to get the Intersection of the two collections and then i use "Any". But i wo...
Bougainville asked 16/5, 2012 at 22:5

1

Solved

Specifically using the new enum keyword provided by Scala 3... enum Translation(val bit: Byte): case FlipX extends Translation(1) case FlipY extends Translation(2) case RotateClockwise extends T...
Leesa asked 19/5 at 19:14

3

Solved

I have a class A and a class B extends A In another class C I have a field private List<B> listB; Now, for some unusual reason, I have to implement this method in C public List<A> ...
Acker asked 7/7, 2010 at 13:14

2

How to make a list lazy, i.e. create a LazyList given a usual one? I tried to find suitable method in Scala documentation, but there is no such function.
Jipijapa asked 30/7, 2020 at 20:30

1

Solved

I don't believe that SortedSet.IsSubsetOf is working as expected. Given this code, shouldn't ss.IsSubsetOf(l) return True? I'm suspicious that the problem is in my CompareTo function, but I can't s...
Therapsid asked 11/5 at 18:5

9

Solved

I have this code below where I am inserting a new integer into a sorted LinkedList of ints but I do not think it is the "correct" way of doing things as I know there are singly linkedlist with poin...
Peraea asked 9/8, 2013 at 10:37

4

Solved

I'm trying to think of a function that would allow a Map<String, Any?> object to be treated as Map<String,Any> through type inference through applying a single function. I am pretty ne...
Idolize asked 18/2, 2017 at 8:17

3

Solved

Here is what I try to do: $q = Question::where('id',$id -> id)->get(); $q[] = $q->push([ 'test' => true]); dd($q); This will output: Collection {#220 ▼ #items: array:3 [▼ 0 =>...
Leadsman asked 17/7, 2015 at 11:9

2

Solved

I'm struggling to get a groupby on a collection to work - I'm not getting the concept just yet. I'm pulling a collection of results from a table for a player the eloquent collection will have data ...
Moretta asked 24/6, 2020 at 8:1

4

Solved

So I want to use the smallest key as the priority and then return the VALUE of that corresponding key: import javafx.util.Pair; import java.util.PriorityQueue; public class Test { public static ...
Cristalcristate asked 9/5, 2020 at 19:3

25

Solved

I need to create a Set with initial values. Set<String> h = new HashSet<String>(); h.add("a"); h.add("b"); Is there a way to do this in one line of code? For instance, it's useful fo...
Laevorotatory asked 11/1, 2010 at 12:31

31

Solved

I want to filter a java.util.Collection based on a predicate.
Evadne asked 23/9, 2008 at 16:26

6

Solved

Is it to maintain backwards compatibility with older (un-genericized) versions of Collection? Or is there a more subtle detail that I am missing? I see this pattern repeated in remove also (remove(...
Fleurette asked 8/6, 2010 at 0:43

2

Below is a block of code that results in exception as indicated, Code : Collections.sort( arrayList, new Comparator() { public int compare( Object o1, Object o2 ) { TypeAdapterSort tas1 = ( T...
Arrangement asked 18/4, 2013 at 8:58

8

Solved

What I'd like to avoid: ManagementClass m = new ManagementClass("Win32_LogicalDisk"); ManagementObjectCollection managementObjects = m.GetInstances(); List<ManagementObject> managementLis...
Isomerize asked 9/10, 2008 at 15:51

5

Solved

I have a list with some identifiers like this: List<long> docIds = new List<long>() { 6, 1, 4, 7, 2 }; Morover, I have another list of <T> items, which are represented by the i...
Money asked 7/3, 2013 at 15:36

15

Solved

In Java there are the SortedSet and SortedMap interfaces. Both belong to the Java Collections framework and provide a sorted way to access the elements. However, in my understanding there is no S...
Famed asked 4/1, 2012 at 10:35

46

Solved

If I have an object implementing the Map interface in Java and I wish to iterate over every pair contained within it, what is the most efficient way of going through the map? Will the ordering of ...
Pesek asked 5/9, 2008 at 21:12

© 2022 - 2024 — McMap. All rights reserved.