Hey,
I'd like to convert an array to a set in Java. There are some obvious ways of doing this (i.e. with a loop) but I would like something a bit neater, something like:
java.util.Arrays.asList(Object[] a);
Any ideas?
Cheers,
Pete
Assume that int array arrayName is a member of class className, How can I access its element in my main program?? className.arrayName[0] doesn't seem to work
I m trying to make an array of labels
each label has a differented value which come out of a function.
I dont know the exact no. of labels to be used
i mean there could be any no of values to b printed
Therefore, please help me do so
1- How to smartly initialize an Array with 2 (or more) other arrays in C#?
double[] d1=new double[5];
double[] d2=new double[3];
double[] dTotal=new double[8];// I need this to be {d1 then d2}
2- Another question: How to concatenate C# arrays efficiently?
Thanks
I have the following code:
function HideTemplates($File, $Templates)
{
foreach ($Template in $Templates)
{
Write-Host $Template[0] $Template[1] $Template[2]
}
}
HideTemplates "test.xml" @(("one", "two", "three"))
HideTemplates "test.xml" @(("four", "five", "six"), ("seven", "eight", "nine"))
It prints:
o n e
t w o
t h r
four five six
seven eight nine
I want it to print:
one two three
four five six
seven eight nine
Am I doing something wrong in my code? Is there a way to force PowerShell to tread a multi-dimensional array with a single item differently?
Is it possible to set 'MaxDegreeOfParallelism' (that is maximum number of threads to use) for Array.Parallel module since under the hood it uses Parallel.For?
$GET = array();
$key = 'one=1';
$rule = explode('=',$key);
/* array_push($GET,$rule[0]=>$rule[1]); */
I'm looking for something like this so that:
print_r($GET);
/*output:*/ $GET[one=>1,two=>2,...]
is there a function to do this (because array_push won't work this way).
thanks!
When I obtain a field 'text' of an array I have to do something like this:
$text = isset($tab['text'][0])?$tab['text'][0]:"";
is there any function that returns value when element $tab['text'] exists and "" when not and of course doesn't produce notice in latter case.
i'd like to record sounds played by tapping with a two dimensional array using the time and the sound id.
is there any code example anywhere?
thanx blacksheep
I need to represent some spatial points: x,y,z
when I try to initialize the array like this:
int[][][] points
{
{
{100, 120, 10},
{100, 120, 18},
...
}
}
I got an error: Uncompilable source code - not a statement
where is the error?
if an array of size n has only 3 values 0 ,1 and 2 (repeated any number of times) what is the best way to sort them. best indicates complexity. consider space and time complexity both
I have such an array:
arr['key1'] = true;
arr['key2'] = true;
arr['key3'] = true;
...
arr['keyN'] = true;
How to determine, have anyone key a "false" value?
I'm looking for the easiest way to sort an array that consists of numbers and text, and a combination of these.
E.g.
'123asd'
'19asd'
'12345asd'
'asd123'
'asd12'
turns into
'19asd'
'123asd'
'12345asd'
'asd12'
'asd123'
This is going to be used in combination with the solution to another question I've asked here.
The sorting function in itself works, what I need is a function that can say that that '19asd' is smaller than '123asd'.
I'm writing this in JavaScript.
I have this array, for example (the size is variable):
x = ["1.111", "1.122", "1.250", "1.111"]
and I need to find the most commom value ("1.111" in this case).
Is there an easy way to do that?
Tks in advance!
I'm trying to initialize an int array with everything set at -1.
I tried the following, but it doesn't work. It only sets the first value at -1.
int directory[100] = {-1};
Why doesn't it work right?
Hi all,
i'd like to call a function using an array as a parameters:
var x = [ 'p0', 'p1', 'p2' ];
call_me ( x[0], x[1], x[2] ); // i don't like it
function call_me (param0, param1, param2 ) {
// ...
}
Is there a better way of passing the contents of x into call_me()?
Ps. I can't change the signature of call_me(), nor the way x is defined.
Thanks in advance
Let's say I have this to create a multidimensional array dynamically:
int* *grid = new int*[gridSizeX];
for (int i=0; i<gridSizeX; i++) {
grid[i] = new int[gridSizeY];
}
Shouldn't be possible now to access elements like grid[x][y] = 20?
i code some configuration setting. And need those values to be load, everytime my webapp start. yes, it's somekind autoload setting.
But, right now, i have to choose between save it as object or array. is there any different between them when we save them in database ? which one is faster or maintainable or other pro and cons
thanks
I have a multi-dimensional array:
a=[[2,3,4],[1,3,4],[1,2],[1,2,3,4]]
i've to compare all the 4 sub-arrays and get common elements.Next,take 3 subarrays at a time and get common elements.then take 2 sub arrays at a time and get common elements, in RUBY.
i'd like to record sounds played by tapping with a two dimensional array using the time and the sound id.
is there any code example anywhere?
thanx blacksheep
Hi,
i basically want to know the differences or advantages in using a generic list instead of an array in the below mentioned scenario
Class Employee
{
private _empName;
Public EmpName
{
get{return _empName;}
set{_empName = value;}
}
}
1. Employee[] emp
2. List<Employee> emp
can anyone please tell me the advantages or disadvaatges and which one to prefer