what should be the parameter for create object the following code
dim a
set a=CreateObject("Collection") //getting a runtime error saying ActiveX
//component can't create object: 'Collection
a.add(CreateObject("Collection"))
a.Items(0).Add(1)
MsgBox(a.Items(0).count)
MsgBox(a.Items(0).Item(0))
...
java.lang.UnsupportedOperationException: This operation is not supported on Query Results
at org.datanucleus.store.query.AbstractQueryResult.contains(AbstractQueryResult.java:250)
at java.util.AbstractCollection.retainAll(AbstractCollection.java:369)
at namespace.MyServlet.doGet(MyServlet.java:101)
I'm attempting to take on...
I was studying the legacy API's in the Java's Collection Framework and I learnt that classes such as Vector and HashTable have been superseded by ArrayList and HashMap.
However still they are NOT deprecated, and deemed as legacy when essentially, deprecation is applied to software features that are superseded and should be avoided, so, ...
During my C learning days, when I had implemented a Queue, I implemented them on top of a LinkedList. So essentially I had two pointers (front and rear) for the Queue operations on top of LinkedList, or better one front pointer on top of a CircularLinkedList.
I am learning the Java Collections Framework, and I observe that the design ha...
I have a list of values that i need to check against a constant list to know wheter they are present or not (one by one).
Im using a dictionary buy it doesnt seem logical to have the value two times (key, value)...isnt there any class specialized for this case (and faster if possible)?
Also it would me more reasonable if it could be de...
Possible Duplicates:
c# array vs generic list
Array versus List<T>: When to use which?
I understand that there are several benefits of using List<>. However, I was wondering what benefits might still exist for using arrays.
Thanks.
...
Please help me with this:
If Lion IS-A Animal and given Cage<T>:
Cage<? extends Animal> c = new Cage<Lion>(); // ok,
but
Set<Cage<? extends Animal>> cc = new HashSet<Cage<Lion>>(); // not ok
What I don't see here?
...
If I have an anonymous type created by LINQ
var ans = from r in someList where someCondition(r) select new { r.a, r.b };
What is the best way to create an empty matching collection so I can move elements to the new collection:
var newans = ?
foreach (r in ans) { if (complicated(r) newans.Add(r); }
Is there some way to use Enumerab...
Hello,
I need to change a method that has one parameter that takes a serie of objects. I need to find the lowest Interface (in inheritance tree) that has the Count property. Until now I was using the IEnumerable but as this has not Count I need to change it to the wider interface possible so the method can work with the biggest number o...
I have a method to which I pass an IEnumerable<TModel>. Then depending on the type of TModel, the method carries out a set of instructions as below:
public void MyMethod<TModel>(IEnumerable<TModel> items) where TModel : class
{
int operationType;
switch (typeof(TModel))
{
case typeof(MyModelOn...
Vector is synchronized but ArrayList is not synchronized but we can synchronize an ArrayList by Collections.synchronizedList (aList), so which will perform better and faster
...
Using Collections class we can make any collection synchronized,immutable or empty
what are there respective uses, when we need to implement these type of collections
...
Hello,
Im using Collections.sort() to sort a LinkedList whose elements implements Comparable interface, so they are sorted in a natural order. In the javadoc documentation its said this method uses mergesort algorithm wich has n*log(n) performance.
My question is if there is a more efficient algorithm to sort my LinkedList?
The size...
I'm a bit fuzzy on the best way to solve the problem of needing a list for each of my business objects that implements some overridden functions.
Here's the setup:
I have a baseObject that sets up database, and has its proper Dispose() method
All my other business objects inherit from it, and if necessary, override Dispose()
Some of th...
Hello,
Can I use Collections.binarySearch() method to search elements in a PriorityQueue? Otherwise, how can I apply search algorithms to a PriorityQueue?
I have this (class Evento implements Comparable):
public class PriorityQueueCAP extends PriorityQueue<Evento>{
// (...)
public void removeEventos(Evento evento){...
How can i create a 3 table schema from the following model classes.
public class Product
{
public int Id {get; set;}
public string Name {get; set;}
public IList<Photo> Photos {get; set;}
}
public class Photo
{
public int Id {get; set;}
public string Path {get; set;}
}
I want to create the following table structure in the da...
While studying the Collection API, we find that some methods (add, remove,...) may throw a java.lang.UnsupportedOperationException if the current implementation of the Collection does not support those functionalities.
Is there,actually, in the JDK, a concrete Collection that does not support those methods ?
Thanks a lot for your answe...
We find a lot of concrete subclasses under Collection.
While trying to add an element in a concrete collection, this collection will use a method to determine if it can accept to store the element (and eventually that this element is not already in the collection).
It could use equals(), hashCode() or compareTo() of the element.
Is it ...
What is Iterator and collections?
Does these two have any relations?
// the interface definition
Interface Iterator {
boolean hasNext();
Object next(); // note "one-way" traffic
void remove();
}
// an example
public static void main (String[] args){
ArrayList cars = new ArrayList();
for (int i = 0; i < 12; i++)
cars.add (new Car());
I...
I want to compare two lists. Since we code to interface using List, which does not inherit the equals from from the Object class. How do I do this?
...