collections

Magento list of related(recommended) products in checkout cart

Hi, i'm tring to put a list of recommended items in checkout cart page, i was trying to use the related products block that is in layaout/catalog.xml, but it works for a single product in product view page, and in the checkout cart page can be more than one product, so, how can i make something like this, if it can be done?? ...

Hook into the moment when the Collection is filled and removing then the Loading Adorner?

Hello, I am grouping data in a WPF DataGrid. that takes very long so I want to show a Loading bar/adorner. I am using MVVM. How would you remove/fade out the loading bar/adorner when the datagrid has finished the grouping. How do I get the moment when the Data is grouped 100% ? Can this somehow be set in xaml or retrieved etc... ? ...

Java: CopyOnWriteArrayList vs synchronizedList

What is the difference between CopyOnWritearraylist and Collections.synchronizedList(..)? When should one be preferred over the other. ...

How to Return an Empty ValueCollection

I have a dictionary whose values I'd like to return to a caller like this: public ICollection<Event> GetSubscriptions() { return isLockDown ? Enumerable.Empty<Event> : subscriptionForwards.Values; } Unfortunately, the empty enumerable type is not compatible with the stated return type. Is there another BCL facility for this? p.s...

Yet another java generics confusion

Let us have the following code: public class TestGenerics { static <T> void mix(ArrayList<T> list, T t) { System.out.println(t.getClass().getName()); T item = list.get(0); t = item; System.out.println(t.getClass().getName()); } public static void main(String[] args) { ArrayList<Object>...

C#: How can I solve "Collection was modified" in a BackgroundWorker progress report callback?

I've used BackgroundWorkers quite a bit, but I've never experienced this problem before. My program analyses the output from a logic analyser producing packets, of which there are thousands. To prevent too much delay updating the ListView in my form (I was previously reporting each one as it was found, and the form was completely unrespo...

compare and sort different type of objects using java Collections

Hi, How to compare and sort different type of objects using java Collections .Below is the use case: For example DOG,MAN,TREE, COMPUTER,MACHINE - all these different objects has a common property say "int lifeTime". Now I want to order these obects based on the lifeTime property Thx ...

How do you remove the overlapping contents of one List from another List?

List<String> listA = new ArrayList<String>(); listA.add("a"); listA.add("b"); listA.add("c"); listA.add("d"); List<String> listB = new ArrayList<String>(); listB.add("c"); listB.add("d"); listB.add("e"); listB.add("f"); ListB contains two elements that are also present in ListA ("c" and "d"). Is there a clean way to make sure that ...

Hibernate Mapping of nested collection in java to mapping table through java annotation?

Problem too specific.closing the same. ...

Hibernate, test if a collection is fully loaded

Hi all, there is a way to test if a collection is already initialized? try-catch only? I have a function work with a lazy collection, and i need to load it only if is not already loaded. Thanks you. ...

.NET collection type for storing recent list

Is there a specific collection type in .NET which allows storing a limited number objects and removing the oldest element automatically? What's the easiest way to implement such "Recent Files" functionality? ...

WPF, DataGridRowHeader, binding to collection

Hello! I have a simple DataGrid. I want to make that every DataGridRowHeader has it own Content. I specified RowHeaderStyle like this: <DataGrid.RowHeaderStyle> <Style TargetType="DataGridRowHeader"> <Setter Property="Content" Value="{Binding Source={StaticResource RowHData}, Path=Parameters}"/> </Style> </DataGrid.RowHeader...

Multi Value Dictionary?

Anyone know of a good implementation of a MultiValueDictionary? Basically, I want want something that allows multiple values per key. I want to be able to do something like dict.Add(key, val); And if the key doesn't already exist, it will add it, if it does, it will just add another value to that key. I'm just going to iterate over it...

New to 2.8 collections. What would this signature look like? Similar to scalaz sequence.

I found a blog post today that mention's scalaz's sequence function. Couldn't you do something as simple as: if (l contains None) None else l If so, what would this function signature look like? contains is in SeqLike, right? Also, from the blog post I thought sequence was going to be something similar to map, but one that would br...

How to persist a collection of interface's Collection<Interface> in JPA ?

Hi, I have an the following scenario: // several classes that implement different interfaces class A implements X,Y {} class B implements Y,Z {} class C implements X,Z {} // other classes that contain collections of one of the interfaces(different objects) class G { Collection<X> mayContainAC; } class H { Collection<Y> mayContainA...

Initializing a Collection Class

Is there a way to have a class collection of inherited types be initialized? For example, here is my code: Public Class CamryCar Property Name As String = "Camry" Property Color As String End Class Public Class RedCamry Inherits CamryCar Sub New() MyBase.New() Color = "Red" End Sub End Class Public...

Why do many Collection classes in Java extend the abstract class and implement the interface as well?

Why do many Collection classes in Java extend the Abstract class and also implement the interface (which is also implemented by the given abstract class)? For example, class HashSet extends AbstractSet and also implements Set, but AbstractSet already implements Set. ...

Is this possible using generics? c#

I know I can solve the following problem just by creating a custom class, but can the following be strongly typed as a List(or any other type)? var x = new object[] { new object[] { new Image(), new TextBox(), new FileUpload() }, new object[] { new Image(), new TextBox() , new FileUpload()} ...

Filter Lazily Initialized Hibernate Collection

This might be a super easy answer, since I'm sure it's not uncommon. I see some similar questions, but nothing that seems to describe my problem. I have two objects: a car and person. They're in a many-to-many relationship, i.e. a car can be owned by multiple people, and a person can own multiple cars. Car has a lazily initialized se...

Making a Count that takes into consideration null check - What should i call it? SafeCount?

public static int SafeCount<T>(this IList list) { return list != null ? list.Count : 0; } What I want to ask is what should I call this method? SafeCount? NullSafeCount? Can you come up with something more short yet non-ambigous? ...