I'm pretty new to Java, so don't kill me :)
FileInputStream files = new FileInputStream(path);
Properties prop = new Properties();
try {
props.load(fis);
.....
Let's say the files is:
Mary goes to school,
or,
not.
How can I see how the information was stocked inside the prop variable. I understand that...
Is this even possible? It seems like I should be able to.
This is my issue. I need to run a web service method from a 3rd party to get a collection of available items where I need the ID and a Status property. Then I have method using LINQ to SQL that retrieves the items that are current.
What I need to do is retrieve the items that ar...
I have created a class called ProductionDataUserControlBase and it derives from class UserControl. This base class has no XAML. Its purpose is to act as a base class for a grid that I encapsulate inside the class so that it can be modified when the class is inherited later. Inside the constructor of the base class, I also create the colu...
I have an interface A, which class B implements.
The following generic method works
public static <T, U extends T> List<T> listFactory(Collection<U> source) {
return new ArrayList<T>(source);
}
but
public static <T> List<T> listFactory(Collection<? extends T> source) {
return new ArrayList<T>(source);
}
does not (compilation err...
Hi, I have problem reading/println after the first two FOR loop in this method.
This is strange. How can I solve this problem?
private int spacing() {
int n = numberOfTriangles();
ArrayList<Double> list_Xs1 = new ArrayList<Double>();
ArrayList<Double> list_Ys1 = new ArrayList<Double>();
for(Polygon p:triangles){
double cX =...
I was using SortedList() in a class which stores about 15-100K data.
Recently my requirements changed, data should not be stored as sorted any more so I switched to List().
However in this case I noticed that List() consumes about 20%+ more memory.
9K items:
SortedList: 105MB
List: 125MB
15K items:
SortedList: 115MB
List: 140...
I'm working on a project, and I'm slightly stuck on one aspect of it. I need to create a class which can manipulate collections of instances of other classes. As part of this, it creates a wrapper object for each instance which has to be able to not only hold the instance, but perform certain operations on it (including equals/hashcode...
Hi,
I need to model in memory a collection web files, but that relationships between them. That is file A (e.g. html) may have a link to file B (e.g. css) and file C (e.g. javascript). Also file D may also require file B. If I wanted to delete file A I would need to make sure any files it uses (e.g. file B) is not also being used ...
Hi All,
I need a little help. I am fairly new to reflection. We're using a 3rd party api and it returns a class called "AddressList". It has public properties within it literally called Address1, Address1Name, Address1Desc, Address2, Address2Name, Address2Desc, Address3, Address3Name, Address3Desc,... Address99, Address99Name, Address99D...
I'm occasionally getting a ConcurrentModificationException when I iterate over a list. A Google search informs me that it's probably because I'm altering that list in another thread while iterating over it and that to make this problem go away I should use java.util.concurrent.CopyOnWriteArrayList....
... except I already am.
Apparent...
Is there a way to take a List and convert it into a comma separated string?
I know I can just loop and build it, but somehow I think some of you guys a more cool way of doing it?
I really want to learn these types of 'tricks', so please explain or link to the docs on the method you use.
...
If I have an array of employees, how can I sorted based on employee last name?
...
Hi,
I can't work out how to do a "find" on a List I have based on use of a value that I'll pass in at run time. If you see my below code, I want to be able to find the CustomClass in the List for which it's Path parameter is equal to X, where X will be defined at run time.
Any ideas how to do such a find on a List? Or is this not po...
Hi,
What type of collection would be best in C# to implement the following requirements do you think?
Need to model web file (e.g. class = "webfile"), so one class only preferred
Model parent & child relationship - In terms of associations a webfile can have multiple child webfiles, and child webfiles can have multiple parents. (thin...
Hi,
I need a case insensitive list or set type of collection (of strings). What is the easiest way to create one? You can specify the type of comparison you want to get on the keys of a Dictionary, but I can't find anything similar for a List.
...
Hi
I am trying to copy the contents of an arraylist into another object. I tried initializing the new ArrayList object in the following ways
newArrList.addAll(oldArrList);
and
newArrList = new ArrayList(oldArrList);
But every time I make a change to one of the array lists, the value also changes in the other ArrayList.
Can someon...
I'm having trouble with the Random class in .NET, I'm implementing a threaded collection which is working fine, except for one smaller detail. The collection is a Skip list and those of you familiar with it know that for every node inserted I need to generate a new height that is <= CurrentMaxHeight+1, here's the code that I'm using to d...
Hi!
I don't know if this could be done, but I have a WCF service that should return a custom object, the object has a collection of another custom object that contains a stream.
when I try to return this object I get
System.Runtime.Serialization.InvalidDataContractException: Type 'System.ServiceModel.Dispatcher.StreamFormatter+Message...
I'm familiar with the problem of modifying a collection while looping over it with a foreach loop (i.e. "System.InvalidOperationException: Collection was modified"). However, it doesn't make sense to me that when I use Linq to create a List of keys to delete from a dictionary, then loop over my new List, I get the same exception.
Code ...
What are the recommendations for exposing a custom collection vs generic one?
e.g
public class ImageCollection : Collection<Image>
{
...
}
public class Product
{
public ImageCollection {get; set;}
}
VS
public class Product
{
public Collection<Image> Images{get; set;}
}
What cases would you consider creating a custom col...