Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/17/12 14:56:24 (13 years ago)
Author:
sforsten
Message:

#1830: the length of lists and dictionaries is set in the constructor

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Dataset.cs

    r7259 r7736  
    7272      rows = variableValues.First().Count;
    7373      this.variableNames = new List<string>(variableNames);
    74       this.variableValues = new Dictionary<string, IList>();
     74      this.variableValues = new Dictionary<string, IList>(this.variableNames.Count);
    7575      for (int i = 0; i < this.variableNames.Count; i++) {
    7676        var values = variableValues.ElementAt(i);
     
    107107      this.variableNames = new List<string>(variableNames);
    108108
    109       this.variableValues = new Dictionary<string, IList>();
     109      this.variableValues = new Dictionary<string, IList>(variableValues.GetLength(1));
    110110      for (int col = 0; col < variableValues.GetLength(1); col++) {
    111111        string columName = this.variableNames[col];
    112         var values = new List<double>();
     112        var values = new List<double>(variableValues.GetLength(0));
    113113        for (int row = 0; row < variableValues.GetLength(0); row++) {
    114114          values.Add(variableValues[row, col]);
Note: See TracChangeset for help on using the changeset viewer.