collections

WPF: Bind Collection with Collection to a ListBox with groups

Hi, sometimes WPF is too complex for me. I've got my "Window1" holding a collection of "Group"s. "Group" is a class with a collection of "Person"s. In the end this should be a contact list. What I simply want to do is to show the groups with its person in a ListBox, where the group name of the list groups equals the Name Property of my ...

Java: Does Collections.unmodifiableXYZ(...) in special cases make a collection object a flyweight?

The possible answers are either "never" or "it depends". Personally, I would say, it depends. Following usage would make a collection appear (to me) to be a flyweight: public final static List<Integer> SOME_LIST = Collections.unmodifiableList( new LinkedList<Integer>(){ // scope begins { add(1); add(2); ...

Moving to new record on Collection

I'm just getting started with collections (ObservableCollections) and I've hit a wall that I assumed would be easy. I'm sure it is easy but I'm just not finding the answer. I have a WPF screen with a DataGrid to the left and TextBoxes to the right of the screen. The DataGrid is bound to the ObservableCollection (Activities) and I can c...

Why BitVector 32 structure is more efficient than BitArray?

Hi all, What is the difference between BitArray and BitVector 32 structure and what are the advantages of BitVector 32 structure over BitArray? Why is the BitVector 32 structure more efficient than BitArray? Thanks in advance. Jay... ...

what happens when you modify an element of an std::set?

Like the question says, If I change an element of an std::set, for example, through an iterator, I know it is not "reinserted" or "resorted", but is there any mention of if it triggers undefined behavior? For example, I would imagine insertions would screw up. Is there any mention of specifically what happens? ...

How to get elements from collection A that not in collection B? i.e. A-B

Possible Duplicate: Disjoint Union in LINQ DUPE: http://stackoverflow.com/questions/801757/disjoint-union-in-linq I know this is a simple collection operation,My code is: var gone = from a in A where B.Contains(a) == false select a; but it not work. ...

How do you associate each Collection's item to another one's?

I have two Collection objects, I want to associate each object of these two in a readable way (HashMap, Object created on purpose, you choose). I was thinking of two loops one nested into the other, but maybe it's a well known problem and has a commonly understandable solution... What if the number of Collection objects raises above tw...

collection value show in Excel

i want to show my collection value in excel .......i don't want to show excel from crystal report....i am also want to show result in doc mode can any one give me any code ,,,,,example or any tutorial to do that....i work on C# window vs 05 ...

Collection Alternative - ConcurrentModificationException

I'm iterating over a JRE Collection which enforces the fail-fast iterator concept. Problem is I need to remove an object's logical partner if the object meets a condition. Thus preventing the partner from also being processed. Can someone suggestion a better collection type for this purpose? Example. myCollection<BusinessObject> for (...

collection value show in Excel

i want to show my collection value in excel .......i don't want to show excel from crystal report....i am also want to show result in doc mode can any one give me any code ,,,,,example or any tutorial to do that....i work on C# window vs 05 ...

Is it OK to have a Java Comparator where order can change dynamically?

I have a set of time stamped values I'd like to place in a sorted set. public class TimedValue { public Date time; public double value; public TimedValue(Date time, double value) { this.time = time; this.value = value; } } The business logic for sorting this set says that values must be ordered in desc...

Lists NotifyPropertyChanging

Well BindingList and ObservableCollection work great to keep data updated and to notify when one of it's objects has changed. However, when notifying a property is about to change, I think these options are not very good. What I have to do right now to solve this (and I warn this is not elegant AT ALL), is to implement INotifyPropertyCh...

Naming Collection Extensions for clarity

Introducing some of the goodness of collection operations to our codebase without adding a new external library dependency, we are adding these methods to our utility package. static public List<T> filter(List<T> source, Predicate<T> filter); static <Y,T> public List<Y> transform(List<T> source, Mutator<Y,T> filter); static public boole...

Implement thread-safe collection for data-binding in .NET

I have a Windows Forms application that displays a form with a DataGridView bound to a custom collection that inherits BindingList. I'm using the BindingSource / DataSource mechanism for data-binding. The form is a monitor that displays status information contained in the collection. Each element of the collection represents status in...

Implement thread-safe collection for data-binding in .NET

I have a Windows Forms application that displays a form with a DataGridView bound to a custom collection that inherits BindingList. I'm using the BindingSource / DataSource mechanism for data-binding. The form is a monitor that displays status information contained in the collection. Each element of the collection represents status in...

What is the correct term for a fixed sized FIFO queue?

What is the correct name for the following data structure? It is: A queue of fixed size New elements are added to the start Whenever the queue gets above a certain size a number of elements are removed from the end ...

Why doesn't ReadOnlyCollection<> include methods like FindAll(), FindFirst(), ...

Following the suggestions of FxCop and my personal inclination I've been encouraging the team I'm coaching to use ReadOnlyCollections as much possible. If only so that recipients of the lists can't modify their content. In their theory this is bread & butter. The problem is that the List<> interface is much richer exposing all sorts of u...

Clearing a Collection of Collections - clear every item first, or just clear all at once?

Suppose I have a Collection of some kind that itself contains Collections; e.g., Dictionary(Of String, List(Of MyClass)). If I want to clear the Collection entirely, does it make any sense to clear every individual child collection before clearing the parent collection, like so: For Each ListDef As KeyValuePair(Of String, List(Of MyClas...

How to get data from Set in one go

I want to get all values of a set interface in one go as a comma separated string. For Example(Java Language): Set<String> fruits= new HashSet<String>(); fruits.add("Apple"); fruits.add("Banana"); fruits.add("Orange"); If I print the set as fruits.toString then the output would be: [Apple, Banana, Orange] But my requirement is A...

Format for Passing a Collection to a Method

I'm using an API that has a method that requires this type of argument: System.Collections.ObjectModel.Collection<GenericTickType> genericTickList How do I instantiate an object for that argument? Here's what I've tried but it keeps saying that the method call has some invalid arguments. List<TickType> ticks_to_get = new List<TickTy...