Questions tagged [toarray]

toarray, to convert from arraylist to array this method can be used. Being language specific for e.g. in Java its its available with ArrayList and in C# its used with List. Use this tag for toarray related questions.

toArray() Returns an array containing all of the elements in this list in the correct order.

Resource

147 questions
0
votes
3 answers

What does x=>(int)x - 48 mean when you add a number to a digit array?

so im taking number input and the im trying to add each digit to an array of int without using any loop here i got an answer int[] fNum = Array.ConvertAll(num.ToString().ToArray(),x=>(int)x - 48); I understand until .toarray(), but I do not…
Vasant Raval
  • 257
  • 1
  • 12
  • 31
0
votes
3 answers

Cast to an array of Message

Good Afternoon in my timezone. I have a "simple" question. I have an ArrayList , but when i transform this ArrayList to array using the method toArray from the ArrayList object and cast it to Message[] it throws an java.lang.ClassCastException ? The…
tt0686
  • 1,771
  • 6
  • 31
  • 60
0
votes
1 answer

Using sklearn's toarray method results in the use of all RAM

In the following code on Google Colab when it reaches to the toarray method, it uses all the RAM. I looked for an answer and it's been suggested the use of HashingVectorizer. How can I implement it in the following code? The shape of…
Asdoost
  • 316
  • 1
  • 2
  • 15
0
votes
2 answers

Convert Collection to int[] array

There are two existing methods named getDetails(...). One expects a minimum of one mandatory parameter and the other expects a collection (doesn't validate the content/size of the collection). The problem is that the collection is sometimes passed…
explorer
  • 1,074
  • 2
  • 11
  • 31
0
votes
0 answers

JDK LinkedList class toArray(T[] a) method returning wrong variable?

I was using the LinkedList class in java as a guide for writing my own doubly linked list (this is for school). In this toArray method: public T[] toArray(T[] a) { if (a.length < size) a =…
Josh314151
  • 66
  • 1
  • 10
0
votes
1 answer

An error occurred while loading the data of the collection file in MongoDB using the toArray() function

const express = require('express'); const app = express(); app.use(express.urlencoded({ extended: true })); const MongoClient = require('mongodb').MongoClient; app.set('view engine', 'ejs'); var db; app.listen(8080, function () { …
0
votes
0 answers

C++ to .NET Csharp swig DoubleVector.ToArray()

I have an object named result, which contains a IntegerVector and a DoubleVector in C++. I generate with a Task(Of Results) n diferent results and have them in gotresults as Taks from result, that is in C++. When I use…
0
votes
1 answer

How do I remove these green dots randomly?

function levelOneGF(){document.body.innerHTML='
user14331657
0
votes
2 answers

How to convert dictionary to double array of their values in c#?

In my programming i have a challenge.. Dictionary dic=new Dictionary(); now i need to convert those dictionary "values" to 'Double' array. i tried like this, string[] strn=dic.Values.ToArray(); but not working. can any one…
kik
  • 247
  • 1
  • 5
  • 15
0
votes
2 answers

Rxjs switchMap + toArray

I am having a problem with rxjs. I have a function that should do this: Having a list of group ids. In the example: of(['1', '2']) For each one of them fetch the list of chats Return merged list of chats When execution reaches toArray nothing…
adrisons
  • 3,443
  • 3
  • 32
  • 48
0
votes
1 answer

How would I get this debug call to print out the actual values of the object?

I understand that Arrays.sort() has a void return type, and that toArray() has return type is an object, so I did an override by passing in the object that I wanted to see. How can I see the contents of my Time object? Sorry if this is a…
0
votes
0 answers

toarray function dont updated outside the blocks

I try to change an array of user in my mongodb from another collection. this is the code: phrases.find({albumID: tileid}).toArray(function(err, results) { if (results.length > 0) { for(var j = 0; j < results.length; j++) { …
Dor Swisa
  • 43
  • 1
  • 7
0
votes
1 answer

ToArray() Throw Exception in C# while converting var to .ToArray()

Following is the code which causing the issue. public static byte[] ToByteArrayWithBom(this string s, Encoding encoding) { var data = encoding.GetBytes(s); long str = data.Length; // 323603364 var premble = encoding.GetPreamble(); var…
0
votes
1 answer

How to convert object to array in php active record

I am using phpactive record. To find all data from one table I am using like below $groups = GroupModel::all(); echo "
";
print_r($groups);

then getting output like 
Array
(
    [0] => GroupModel Object
        (
            [errors] => 
    …
0
votes
1 answer

How to make a generic type T Array for a generic SortedLinkedList?

I have implemented a SortedLinkedList with generic types but one of the assignments is to make a toArraymethod that takes a T[] array and fills it with the elements of the Linked List. For this, I figured I'd make a get()method that returns the…
Raighley
  • 59
  • 7