primitive Questions
3
Solved
I'm trying to understand how async/await works in conjunction together with promises.
async function latestTime() {
const bl = await web3.eth.getBlock('latest');
console.log(bl.timestamp); ...
Crites asked 14/7, 2018 at 11:56
21
Solved
Since Java 5, we've had boxing/unboxing of primitive types so that int is wrapped to be java.lang.Integer, and so and and so forth.
I see a lot of new Java projects lately (that definitely requir...
Gunlock asked 4/3, 2011 at 21:16
11
Solved
Why I cannot do this in java?
Object[] o = (Object[])(new int[]{0,1,2,3.14,4});
I have a method that receives an object and then represents it as a string, but depending on his type (primitive, ...
8
Solved
7
Solved
As of Java 1.5, you can pretty much interchange Integer with int in many situations.
However, I found a potential defect in my code that surprised me a bit.
The following code:
Integer cdiCt = ....
Puzzlement asked 3/9, 2010 at 17:3
11
Solved
I have a class that I want to use to store "properties" for another class. These properties simply have a name and a value. Ideally, what I would like is to be able to add typed properties, so that...
Clarindaclarine asked 12/8, 2008 at 9:13
8
Solved
As far as I can tell, any static member of a class like String or Int32 can also be accessed from the related primitive data type. So, String.Format is the same as string.Format, and Int32.MaxValue...
3
Solved
I've designed my app domain with custom F# types, but now it seems like these custom types will be a PITA when I want to actually use the data for various tasks... i.e. writing values to a CSV file...
1
Solved
I'm reading java OCA certification documentation.
Some primitive operations behavior seems realy strange for me.
it is said that all byte, short and char value are automatically widening t...
6
Solved
If a method has a local variable i:
int i = 10;
and then I assign a new value:
i = 11;
Will this allocate a new memory location? Or just replace the original value?
Does this mean that primi...
4
Solved
Are the primitive data types like int & short thread-safe in Java? I have executed the following code and couldn't see expected result 500 some times.
public class SampleThree extends Thread
{...
Falls asked 14/2, 2012 at 14:38
8
Solved
I need to make some reflective method calls in Java. Those calls will include methods that have arguments that are primitive types (int, double, etc.). The way to specify such types when looking up...
Acclimate asked 7/10, 2008 at 19:54
4
Solved
How large, in bytes, is a boxed primitive like java.lang.Integer or java.lang.Character in Java?
An int is 4 bytes, a typical pointer is also 4 byte (if not compressed by the JVM). Is the cost for...
Prosy asked 27/1, 2012 at 17:29
2
Solved
When searching for explanations of how logical equals == works in Java the answers are always something along the lines of:
For primitives it returns whether the primitives have the same value (t...
Jayjaycee asked 18/8, 2019 at 2:25
3
Solved
I'm new to Android/Java. I'd like to write a test application where any arbitrary extra that I add to a (custom) intent is printed.
When I receive the intent with my BroadcastReceiver, I can get al...
Velvetvelveteen asked 22/10, 2013 at 13:14
3
Solved
In the Kotlin language we, by default, have to initialize each variable when it is introduced. To avoid this, the lateinit keyword can be used. Referring to a lateinit variable before it has been i...
Inhibit asked 4/8, 2016 at 7:40
3
2
Solved
Is there an equivalent function for Math.signum(double) or Math.signum(float) in Java for other primitive numbers like int or long. I don't want to write code like
int sign = (int) Math.signum((d...
11
Solved
I need to create a data transfer object, which I will use for storing the records retrieved from database. In this data transfer object, I need to declare a numeric field. For that which one is bet...
Lesson asked 8/1, 2009 at 9:38
1
Solved
Background
I'm looking at the jazz package proposed by Romain François. Romain defines a function is_bare_vector with the following syntax:
is_bare_vector <- function(x) {
is_vector(x) &&...
2
Solved
Is there a way to override the default deserialization behaviour of Json.net when handling primitive types? For example when deserializing the json array [3.14,10,"test"] to a type of object[] 3.14...
1
Solved
Consider this function that generates a list for an arbitrary Monad:
generateListM :: Monad m => Int -> (Int -> m a) -> m [a]
generateListM sz f = go 0
where go i | i < sz = do x &...
9
Solved
I want to detect duplicate values in a Java array. For example:
int[] array = { 3, 3, 3, 1, 5, 8, 11, 4, 5 };
How could I get the specific duplicated entry and how many times it occurs?
Seism asked 19/3, 2011 at 18:53
2
Solved
Here is an example class. I know the simplest thing would be to change the members from primitive type int to object Integer and use stream/lambda/sorted, but there may be reasons to only have a pr...
Hexyl asked 1/9, 2018 at 13:23
7
Solved
I read this line in the Java tutorial:
byte: The byte data type is an 8-bit signed two's complement integer. It has
a minimum value of -128 and a maximum value of 127 (inclusive). The
byte da...
© 2022 - 2024 — McMap. All rights reserved.