» Home » List » Page 1
Replace list of list with “condensed” list of list while maintaining order
Category : 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


View Replies


Reversing 'a list list -> 'b list list but getting pattern matching is not exhaustive
Category : 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]]

View Replies


Calling setter method of object in List also changes properties of other objects in List. List is value in HashMap
Category : 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");
list3.get(0).setName("testobject");
for(TestObject to : list3){
System.out.println(to.getName());
}

Inste


View Replies


How to select list of keyvaluepairs in List<List<keyvaluepair<string,double>>> and modify their values ? C#
Category : 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


(house,40),(home,20),(monitor,40)
(home,10),(work,60),(monitor,30)
(school,70),(home,10),(word,20)

View Replies


“Elegant” way to get list of list of property values from List<T> of objects?
Category : 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 = ???? )


I


View Replies


GWT list box - how to set different font/background parameters to list items than the main list view
Category : 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:


ListBox BACKGROUND/FONT1
item BACKGROUND/FONT2 aaaa /item
/ListBox


Thanks in advance


View Replies


How to count lists inside another list List<List<KeyValuePair<string, double>>>
Category : 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.


View Replies


calling list that takes a typed list with a method that returnes a generic list?
Category : 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<>())


View Replies


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?
Category : 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>();
strings.add("a");
strings.add("b");
for (String string : strings) {

View Replies


In Windows Forms C# updating a List<List<T>> updates already input List<T> entries
Category : 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


View Replies


Next
2012 / 2017 Copyrights BigHow , All Rights Reserved .