» Home » list » Page 1
Replace list of list with “condensed” list of list while maintaining order
by Bakafish in Programming Languages

I have a list of list as in the code I attached. I want to link each sub list if there are any common values. I then want to replace the list of list with a condensed list of list. Examples: if I have a list [[1,2,3],[3,4]] I want [1,2,3,4]. If I have [[4,3],[1,2,3]] I want [4,3,1,2]. If I have [[1,2,3],[a,b],[3,4],[b,c]] I want

Reversing 'a list list -> 'b list list but getting pattern matching is not exhaustive
by znotdead in Web Design

This assignment is from Induction to Programming using sml 5.14

Here is my code but I get this message pattern matching is not exhaustive in in base case..

fun revrev [] = [[], []]
| revrev [x::xs,y::ys] = revrev[ys@[y], xs @ [x]];
val test1revrev = revrev [[1, 2],[3, 4, 5]];
From valtest1 I want the output [[5, 4, 3], [2, 1]]

How to select list of keyvaluepairs in List<List<keyvaluepair<string,double>>> and modify their values ? C#
by Nick in C & C++ & C#

Now the question is pretty hard. Now this is my main list

List<List<KeyValuePair<string, double>>> dblWordFreqByCluster = new List<List<KeyValuePair<string, double>>>();

So lets give example list


Calling setter method of object in List also changes properties of other objects in List. List is value in HashMap
by Geoffrey De Smet in Programming Languages

I have a Map containing Strings for keys and Lists as values. After putting several entries into the Map and randomly expanding the List values in the Map I get the following problem:

list3 = map.get("string1");
for(TestObject to : list3){


calling list that takes a typed list with a method that returnes a generic list?
by 02ranger in Programming Languages

why is it
a method with the signature:

public void foo(List<String> string)

cant be called by guavas: foo(Lists.newArrayList())

or java7s: foo(new ArrayList<>())

How to count lists inside another list List<List<KeyValuePair<string, double>>>
by Peter Z in Programming Languages

Now this is example list :

List<List<KeyValuePair<string, double>>> dblWordFreqByCluster =
new List<List<KeyValuePair<string, double>>>();

What i want is getting the list count at this main list (dblWordFreqByCluster). Which means getting count of List<KeyValuePair<string, double>> lists.

In intellij, how can I extract a method that adds to a list and returns the list instead of uses a list as an argument?
by nologicon in Programming Languages

If I start with a method like this:

package com.sandbox;
import java.util.ArrayList;
import java.util.List;
public class Sandbox {
public static void main(String[] args) {
List<String> strings = new ArrayList<String>();
for (String string : strings) {

GWT list box - how to set different font/background parameters to list items than the main list view
by Bunny loves data in Web Design

Is it possible to have different fonts/backgrounds in ListBox main view and for list items in drop down menu? Or is it possible to stop displaying text in ListBox main view what could help solve problem?

something like that:

item BACKGROUND/FONT2 aaaa /item

Thanks in advance

“Elegant” way to get list of list of property values from List<T> of objects?
by M0dusFRee in Programming Languages

Say I have a Customer class with the usual properties: CustomerID, Name, etc.

As a result of a query, I get a generic list of Customer objects: List<Customer>

Is there an elegant way to get an array/list of CustomerID or Name property values from this generic list? (i.e. string[] customerIDs = ???? )


In Windows Forms C# updating a List<List<T>> updates already input List<T> entries
by Itchrelief in C & C++ & C#

I have an object called particle that has its own properties (position, velocity, etc.) and in my windows form I create a list of particles. This list of particles is then updated in the code (i.e. each particle's position, velocity, etc. is updated in each iteration step).

What I want to do is add this List<Particle> to another list List<List<Particle

Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2017 © bighow.org All Rights Reserved .