Linked Questions

2 votes
1 answer
947 views

Is it faster to assign a long value to an int variable using a cast or is using a long variable faster? Or it is a choice, between consuming more memory and processing more? Here is an example test: ...
Marcus Becker's user avatar
57 votes
4 answers
81k views

When you are developing an Android program; and you want to have a ArrayAdapter you can Simply have a Class (most of times with ViewHolder suffix) or directly inflate your convertView and find your ...
mohammad jannesary's user avatar
18 votes
5 answers
26k views

I know there are two types of casting that are implicit and explicit castings. I read different questions on the StackOverflow such as this, this and this but I am still wondering what is the cost of ...
Jack's user avatar
  • 6,706
18 votes
6 answers
48k views

I'm new to Hibernate. I'm trying to get a list of first name and last name of all administrators. There are two warnings in my following code. I already tried to search a lot online. 1) Query is a ...
Chenya Zhang's user avatar
14 votes
10 answers
16k views

I'm currently tutoring a high school student in AP Java and she asked me a question about "double casting". I did not ever hear of this term before, but apparently her teacher expects her to know it ...
corgichu's user avatar
  • 2,600
8 votes
6 answers
4k views

I am considering whether it is better to have two pointers, one for each object sub class and super, or whether I should just use casting. How much system resources does this use: objectName....
GC_'s user avatar
  • 1,671
4 votes
3 answers
3k views

I've a Servlet filter which performs the following type cast: HttpServletRequest httpRequest = (HttpServletRequest) req; At present my filter is responsible for two tasks that would be better ...
deamon's user avatar
  • 93.1k
6 votes
5 answers
957 views

I'm writing a large scale application where I'm trying to conserve as much memory as possible as well as boost performance. As such, when I have a field that I know is only going to have values from ...
asteri's user avatar
  • 11.6k
2 votes
4 answers
2k views

Situation I have a BaseActivity from which I extend other activities. In the BaseActivity I have a findCastedViewById which basicaly casts the view and then returns it. I do this because I, ...
Sid's user avatar
  • 15.1k
0 votes
5 answers
747 views

i want to know if there is only safety risk or there are also other benefits i get when parameterizing the list. i get this warning List is a raw type References to generic type List should be ...
yossi's user avatar
  • 13.4k
1 vote
4 answers
899 views

when I create Animal x=new Dog(); and I want to use Dog functions, I would have to cast right ? ((Dog)x).bark(); so let's say I would use this many times in for loops does that result in lower ...
Ismail Marmoush's user avatar
5 votes
2 answers
278 views

Background I've been running a code (posted at the bottom) to measure performance of explicit Java downcasting, and I've run into what I feel like is a bit of an anomaly... or perhaps two anomalies. ...
Cat's user avatar
  • 67.6k
1 vote
1 answer
1k views

In Java there is a method that has a parameter, and this parameter is an Interface. Using such method can I do a cast to a concrete class? How can I calculate the cost of this cast performance-wise? ...
dev30's user avatar
  • 11
0 votes
4 answers
959 views

I have a method dummy with A as class parameter, but i need to pass instance of subclasses B to that method. I know from: Does Java casting introduce overhead? Why? that downcasting in java have ...
Mohammad Fajar's user avatar
-3 votes
6 answers
406 views

ı want to use short form for if statement. How can ı write if statement at one line? and how can ı compare them ı know there is same question at here. but my statement do not have else so ı could not ...
user2583040's user avatar

15 30 50 per page