Questions tagged [collections]

11342 questions
1

votes
1

answer
31

Views

How the Java HashMap internal data structure changes during rehashing?

I am trying to write demo code to show rehashing is happening in Hashmap when the map size exceeds the load factor threshold. How can I prove rehashing is happening internally . Also I want to prove that eventhough the old entries are moved to new buckets during rehash , I can get the old elements...
JavaUser
0

votes
1

answer
20

Views

Refresh collectionView on viewdidload after retrieving UserDefaults

I have a collection view, and you can select the items in it and toggle them on and off by changing the background colour. The cells are toggled on/off thanks to a boolean I have in an arrow I made for all of the cells. I have saved the bool value but when I try to write them back into the array a...
YachtSamba
1

votes
2

answer
64

Views

Missing records from Mule ConsumerIterator

I am using a Mule component to process records from a Salesforce query. I wrote a Mule component to use the ConsumerIterator to aggregate the records in batches of 100. However, I don't get all the records. I included a simple count to count all the records and I am using an AtomicInteger to count t...
BreenDeen
1

votes
0

answer
24

Views

Symfony3- can´t access to collections data (get)

I have an object with several collection. I saved the data correctly and then, when I do 'object->getCollection()', I didn´t obtain the data. This are my entities: Persona: /** * @ORM\OneToMany(targetEntity='PersonaDomicilio',mappedBy='idPersona',cascade={'persist'},orphanRemoval=true) */ public $d...
1

votes
1

answer
73

Views

Mongo Command to filter a field based on its length

I have a mongo collection where Iam trying to filter all the records with a specific field of length =1 Iam trying to use below command and it gave below error ,can someone help here db.getCollection('accdetails').find({$where:'bankDetails.length = 1'}).sort({$natural:-1}) Below is the error Error:...
hammy
1

votes
0

answer
267

Views

Find latest record for based on multiple ID's using Meteor

I have a collection in mongodb which has the following format: { parentId: '12345akNu', createdAt: '2018-12-02', complete: false } I would like to find all most recent records for a set of parentId's which are not completed. I currently have this query to find all records, but I cannot figure out h...
Hans
1

votes
0

answer
242

Views

Work with associative arrays INDEXED BY VARCHAR2 based on different record types where not all elements may not be present

I am trying to work with with parsed data and place into structures to work with. I have found a Steve Feuersteins package that takes a string, and given seperator(s) will split it out into associative arrays and nested associative arrays. With some tweaking I have fit it to some additional things I...
programmerNOOB
1

votes
0

answer
108

Views

What is the Best C# Sortable Serialized List that can be used with DataContract?

As a part of a class, I have some Immutable POCO objects just to act as a Data Transfer Object for a configuration file. [DataMember] public IReadOnlyList Messages { get; } = new List() { new Warning(75, 'UserMessage1', 'LogMessage1'), new Warning(90, 'UserMessage2', 'LogMessage2'), new Error(100, '...
Ryan The Leach
1

votes
1

answer
32

Views

Collection of subclass objects that inherit (share) common superclass attributes

I'm trying to make a subclass to inherit attributes from its super, but at the same time, the super stores a collection objects of the subclass. Here's my try but I'm feeling this is not an efficient way to do it and probably there's other much better ways to implement it. class SuperCls: def __ini...
Bravhek
1

votes
0

answer
38

Views

How to clear an object of list after it gets processed once with iterator

I have one method which is writing is processing csv file as below: public void processFile(Mapper mapper) { List outputDataList = new ArrayList(); Iterator iter = this.addressLists.iterator(); while (iter.hasNext()) { List listOfAddress = iter.next(); for (AddressDto address : listOfAddress) { this...
user9193174
1

votes
1

answer
39

Views

How to get Laravel Collection from images using views

I have two tables images and views. images: user_id, name, path. views: user_id, viewable_id, viewabe_type, count. Image has Polmophic relation through viewable_id. How do i extract Laravel Collection of Images that have view count over 100?
Timothy Kimemia
1

votes
1

answer
103

Views

Indexing Faces with AWS Rekognition

I am new to AWS and am trying to use Rekognition to identify certain people in a crowd. I am currently trying to index the images of the separate individuals but have hit a snag when trying to create a collection. There seems to a data type compatibility issue when I try using Amazon.Rekognition.Mod...
willed42
1

votes
2

answer
98

Views

Stack sub Stack creation

How to create a stack within a stack? Like [[1 2 3][3 4 5][6 7 8]] So there are three substacks like [123], [456], [789] which sit within a main stack. How do I create it with stack build in function in Java?
Rima Sur
1

votes
0

answer
104

Views

Is there any way I can know creation date of an Index for MongoDB tables(collections)?

Is there any way I can know creation date of an Index for MongoDB tables(collections)? Recently, we saw some indexes which lead to some problem of space and performance and wonder if we can get the timestamp for create_date of the indexes. And I'm not sure if there is a way to do that in the most r...
Tony
1

votes
1

answer
28

Views

How to collapse a collection into one and sum specific keys

I have following collection: array:2 [▼ 0 => array:21 [▼ 'id' => 1 'referrer' => 'Kariane Muller DVM' 'path' => null 'tracking_code_id' => 30 'sales' => 2 'field_name' => 'ssn' 'income' => 4.0 'fsId' => '1b5e4434-da5a-342e-9b87-df9791b1bcc1' ] 2 => array:21 [▼ 'id' => 1 'referrer' => 'Kariane...
PrStandup
1

votes
1

answer
51

Views

How can I install SCL on Oracle Linux 6?

I would like to use the SCLs, but cannot find a way to install the release file. Is it possible to install SCL on Oracle Linux 6 and, if so, how?
Jörn Guy Süß
1

votes
0

answer
83

Views

How to sort UsageStats list accordingly TimeInForeground?

Here is the code that I am using to get List of UsageStats of every installed application. List usageStatsList = getUsageStatistics(UsageStatsManager.INTERVAL_DAILY); SortedMap mySortedMap = new TreeMap(); Collections.sort(usageStatsList, new SortListComparatorDesc()); Here is the SortListComparoto...
Ammy Kang
1

votes
0

answer
31

Views

Are Collection MetaClasses different from other MetaClasses?

As this image shows, I can get a MetaMethod from the String and other MetaClasses, but IDEA says that it cannot resolve 'getMetaMethod' for the Collection or the List MetaClasses and it returns null. Is the Collection MetaClass different from other Object MetaClasses? Edit: Here is the code def list...
Jarv
1

votes
2

answer
82

Views

Properly sort equal items in Collection

According to Documentation Java SE7 This sort is guaranteed to be stable: equal elements will not be reordered as a result of the sort. Collections.sort(gpsDtoList, new Comparator() { public int compare(T o1, T o2) { return -o1.getEreigniszeit().compareTo(o2.getEreigniszeit()); } }); Knowing this f...
0x45
1

votes
0

answer
49

Views

How to fetch additional models from different URLs into an existing collection

I have created a backbone collection like the following: var MyCollection = Backbone.Collection.extend({ model : MyModel, url: 'my_doc.json', }); It works fine. A backbone view create a new MyCollection and uses this collection. But my_doc.json file will grow up and readability will be decrease. So...
SayMyName
1

votes
0

answer
52

Views

Which collection is better to use in MapReduce Program(Java)

Recently I have created a MapReduce program in Java and in mappers and reducers code I use TreeMap. And after submitting the code I got the response that, 'the use of local data structure is not preferable'. So My question is, how it will affect the program if I use TreeMap or any other Map, and if...
Kumar Harsh
1

votes
1

answer
46

Views

Is the order of the rows returned by the TABLE function guaranteed to be identical to the order in which the elements of the VARRAY are stored?

I am executing a delete statement using bind variables of type: CREATE OR REPLACE TYPE 'VAR_ARR' AS VARRAY ( 5000 ) OF VARCHAR2(20) The delete statement looks as follows: DELETE FROM ins_test WHERE ( id, name ) IN ( SELECT t1.id, t2.name FROM ( SELECT column_value id, ROWNUM r FROM TABLE (:1 ) ) t1...
user2672165
1

votes
1

answer
190

Views

laravel collection methods with custom attributes

is there a way to use for eloquent collection methods like map,filter on custom attributes ? public function getDoneAttribute(){ true; } $uncomplete_todos = $todos->filter(function($key,$value){ return $value->done; }); this error shows up Trying to get property of non-object
Pavol Martis
1

votes
0

answer
105

Views

efficient way of loading XML file in scala

What is the efficient way of loading XML file in Scala? I do not want to load the complete file into memory as they can go upto 1 GB in my case, but read only required tags. Let me know. Thanks
Pratap D
1

votes
1

answer
90

Views

How can I replace a given -Ldir1 by -Ldir2, in a linking command line generated by cmake

I have a CMakeLists.txt. I use it for generating a makefile with ccmake. Then upon make, my sources are compiled ok. At link time, the command line produced is essentially /opt/rh/devtoolset-6/root/usr/bin/c++ myprog.cc.o -o myprog -Ldir3 -L/opt/rh/devtoolset-3/root/usr/lib/gcc/x86_64-redhat-linux/4...
sancho.s
1

votes
0

answer
213

Views

Jackson - Serialize Java Class with Collection to JSON

I have a Java class called Account. I was hoping to serialize the list of items along with each instance of Account. How do I do this? Also, is it possible to store accounts to one file and then items to a separate file (almost like a database)? public class Account { private String id; private Stri...
Callum Osborn
1

votes
1

answer
30

Views

How do you use a collection as an argument for a function? (Can't see why my code returns value error)

I'm having difficulty getting a function with a collection as its argument to do anything. I have a function that outputs a collection function ext(P as string) as collection dim serv as new collection serv.add P, '1' set ext = serv end function ive tried to make a second function that takes collect...
Lewis Bavin
1

votes
1

answer
485

Views

Type error: Argument 2 passed to with() must be callable or null, object given

Route::get('/',function (){ $collection = collect(['product'=>'chair','price'=>100]); //dd($collection); return view('welcome')-with('prices',$collection); }); I want to pass $collection on view but I get this error: Type error: Argument 2 passed to with() must be callable or null, object given...
sava milin
1

votes
1

answer
34

Views

Service methods operating on ManyToMany collection and Law of Demeter

I have problem designing service methods operating on @ManyToMany collection in my SpringMVC/Hibernate Rest Web Application without using long method chains that break Law of Demeter. My application has recipes, and inside recipe there is collection of ingredients. I'm not sure if operations like a...
Michal Ruszkowski
1

votes
1

answer
232

Views

Magento pagination for custom collection

I have created a module in which i am using pagination.I have 901 products which satisfy my filtered collection but i want to get only 360 products. see below code for more understanding.. class Test_Module_Block_Listmore extends Mage_Catalog_Block_Product_List { public function __construct() { pa...
Karan Adhikari
1

votes
1

answer
62

Views

Custom collection iterable for an ArrayList matrix

I have a class called matrix which creates a 2d ArrayList matrix. public class Matrix implements Iterable { private ArrayList matrix; } It is fully functioning as a matrix but I need a way to iterate through each inside ArrayList (the rows). My solution being: public Iterator iterator() { Iterator...
supahughman
1

votes
1

answer
269

Views

How to create array or Collection of anonymous class objects

I need to create an array or collection of anonymous class objects. For example the toString of my constructor is: public String toString() { return String.format('%10s%12s%12d', getFirstName(), getLastName(), getAge()); } I can create a list of MyClass objects: List list = new ArrayList(); But now...
Pouria Mohseni
1

votes
1

answer
33

Views

Removing Values from a HashSet that are connected to a key?

I want to withdraw a student from a school class. The following method is not removing the value? Ideas please: public static void withdrawStudent(String student) { enrollments.values().remove(student); } public static void main(String[] args) { enroll('101', 'Pat'); withdrawStudent('Pat'); } // Her...
Shaz
1

votes
0

answer
94

Views

How can we create email alert for Scheduler Job Collections

How can we create email alert for Scheduler Job Collections for example : i have a situation where i have to create a heartbeat solution for REST APIs (configured in APIM), if any endpoint fails i want an email alert
Apoorv
1

votes
0

answer
53

Views

Java: Collection load factor or how create fixed size set or map

In my project i have special utilitarian methods .of() in classes MySet and MyMap to make work easier. public static Set of(V v1){ Set result = new LinkedHashSet(); result.add(v1); return result; } public static Set of(V v1, V... other){ Set result = new LinkedHashSet(); Collections.addAll(result,...
mikewoe
1

votes
0

answer
73

Views

WinForms - Custom Collections & Collection Editor

I want to create a user control that the user can add buttons to it at design time. So I've created a class called ButtonsContainer that inherits from UserControl, I've also created a class ButtonsCollection that inherits from CollectionBase, in the ButtonsContainer class (the user control) i put a...
D.Rotnemer
1

votes
0

answer
33

Views

mongo eve for different users display different collections

I am using eve to read different databases from this post but I still have a question using 'Auth-driven Database Access'. I have three databases named db1(has one collection named collection1), db2(has one collection named collection2), db3(has one collection named collection3). and my setting.py...
user9622530
1

votes
0

answer
64

Views

consequence of compare() method of Comparator interface not consistent with equals() method

Say I have class A, which override the default equals method and implement Comparable interface (Comparable interface is said to be the natural ordering). To conform to good practice, the result returned by equals and Comparable's compareTo method should be consistent. On some occasions, I want to...
Thor
1

votes
0

answer
176

Views

nested defaultdict: TypeError: first argument must be callable or None [duplicate]

This question already has an answer here: Multi-level defaultdict with variable depth? 10 answers Multiple levels of 'collection.defaultdict' in Python 6 answers Truing to create a nested defaultdict to avoid having to write long code. The final defaultdict should looks like this: dd = {str:{str:{...
Milano
1

votes
2

answer
108

Views

Scala parallel collections

I am very naively trying to use Scala .par, and the result turns out to be slower than the non-parallel version, by quite a bit. What is the explanation for that? Note: the question is not to make this faster, but to understand why this naive use of .par doesn't yield an immediate speed-up. Note 2:...
Frank

View additional questions