I'd like to map a one to many collection to a subclass but the key of the collection is an attribute of the parent class.
Currently i'm mapping AbstractFoo Foo and Bar class like this :
<class name="AbstractFoo" abstract="true" table="abstractFoo">
<id name="_id" column="foo_pk">
<generator class="native" />
</id>
<many-to-on...
If all attributes (or items fields, or data members) of a java collection are thread-safe (CopyOnWriteArraySet,ConcurrentHashMap, BlockingQueue, ...), can we say that this collection is thread-safe ?
an exemple :
public class AmIThreadSafe {
private CopyOnWriteArraySet thradeSafeAttribute;
public void add(Object o) {
...
Is there a better way to have a listener on a java collection than wrap it in a class implementing the observer pattern ?
...
I have a list of nullable ushorts :
List<ushort?> items = new List<ushort?>();
and I'm trying to get the following to work, but I can't - for some reason.
int GetIndex(ushort value)
{
return ?
}
what I'm trying is :
ushort? x = value;
int idx = items.FindIndex(x);
But I'm getting :
"Best overloaded method has some invalid ...
This is my code to construct a possible tour of citys in a Locale l (it's not optimal it's just to give my AI search a head start).
I'm getting a ConcurrentModificationException, which to my knowledge happens when more than one piece of code accesses an variable / collection and attempts to modify it. Causing this code to get unhappy:
...
i have this:
jLabel1.setBorder(null);
jLabel2.setBorder(null);
jLabel3.setBorder(null);
jLabel4.setBorder(null);
jLabel5.setBorder(null);
jLabel6.setBorder(null);
i want to make it simpler and less noob... any ideas?
...
Is there any method I can send to an object, which will return an enclosing collection (NSDictionary/NSArray)? Or a method which would return a collection of all the objects with a retain call on the object in question?
DJS.
@bburn:
It possibly is a design problem. I'm trying to parse an XML document, and more or less convert the entir...
First, let me specify I am refering to the List<T> method and not the C# keyword. What would be Microsoft's reasoning for having the Foreach method on the List<T> collection but no other collection/enumerable type, specifically IEnumerable<T>?
I just discovered this method the other day, and found it to be very nice syntax for replacin...
Hello,
We developped our application with Subsonic 2 and c#.
LazyLoading config has been set to false, all our application has been developped that way.
But now we have run on memory problems when loading large collections and then serialize them (to send it back via web services).
We can't enable lazy loading now as we would have to ed...
public class MyGraph<V,E> extends SparseMultigraph<V,E>{
private ArrayList<MyNode> myNodeList;
public MyNode getNode(int nodeId){
myNodeList = new ArrayList<MyNode>();
myNodeList = (ArrayList<MyNode>)this.getVertices();
int i;
The following are the error msg:
Exception in thread "main" java.lang.ClassC...
Many times there is a clear method, that removes all the items from the collections, are these items disposed also.
Like,
toolStripMenuItem.DropDownItems.Clear();
is sufficient, or should I have to call like that:
foreach (ToolStripItem item in toolStripMenuItem.DropDownItems)
{
toolStripMenuItem.DropDownItems.Remove(item);
ite...
I am stuck here:
my input file:
123 456 789
872 727 282
123 838 831
818 833 939
Now, I need to save data in a hashmap, 2d array or any best possible alternative like this:
key value
123 -> 456, 789, 838, 831
872 -> 727, 282
818 -> 833, 939
What is the best possible way (simple and optimized) to achieve this and using what?
I a...
Hi, all!
Is there a kind of implementation (at least partial) of java collections (Set, List, Map, Collection ...) for Delphi 2010?
I need it for make porting code from java to Delphi a little bit easier.
...
public class Item
{
public int ID {get;set;}
public string SKU {get;set;
public int Quantity {get;set;}
}
I pull items from my database like:
List<Items> savedItems = Db.GetItems();
I then have this method that takes in a collection of items:
public void Update(List<Items> items)
{
// update database
}
...
Suppose I have a dictionary in C#. Assuming the keys are comparable, how do I find the smallest key greater than a given k (of the same type as the keys of the dictionary)? However I would like to do this efficiently with a collection like a SortedDictionary.
Clearly, if it were not a question of doing it efficiently one could start w...
My code is old code which uses ArrayList to store elements of collection. I use the m_objects.SyncRoot for locking purpose before delete the object:
lock(m_objects.SyncRoot)
{
m_objects.Remove(obj);
}
The issue now is, I now want to change the type of m_objects from ArrayList to List<T>, and I en...
Hi,
I want to duplicate a collection of entities in my database.
I retreive the collection with:
CategoryHistory chNew = new CategoryHistory();
CategoryHistory chLast = (CategoryHistory)em.createQuery("SELECT ch from CategoryHistory ch WHERE ch.date = MAX(date)").getSingleResult;
List<Category> categories = chLast.getCategories();
chN...
I want to create a collection of objects that implement a given interface (in C# it would be something like Collection<IMyInterface>). I don't care about sorting or indexed access but would like to easily iterate over the collection with foreach (or the Java equivalent). It also needs to have as small a memory footprint as possible (and ...
This sadly doesn't work:
long[] longs = new long[]{1L};
ArrayList<Long> longArray = new ArrayList<Long>(longs);
Is there a nicer way except adding them manually?
...
Embarrassing question really -- I have Subsonic collection, then I filter out some data using Where.
MyColl.Where(it => it.foo()==true)
now I would like to pass those data still as Subsonic collection. How to do it (the most properly way)? I checked constructor for Subsonic collection, ToX() methods, and googled.
edit: Subsonic 2.x...