I need a shallow copy of an java ArrayList, should I use clone() or iterate over original list and copy elements in to new arrayList, which is faster ?
I want to compare to variables, both of type T extends Number. Now I want to know which of the two variables is greater than the other or equal. Unfortunately I don't know the exact type yet, I only know that it will be a subtype of java.lang.Number.
How can I do that?
Thanks!
I am looking for seminal and excellent examples of libraries and projects that emulate the good practices of the Java Concurrency in Practice book.
The book is marvelous. However, I think supplementing this book reading with code reviews of projects and libraries that make use of the concurrency APIs effectively is necessary to drive the concepts into the brain.
One good example of what I am looking for is
https://code.google.com/p/concurrentlinkedhashmap/
Can folks help me with finding exemplary, well written code that use the concurrency api well?
I would like to have a button in my window such that if I click it (button) the window is closed.
I found out that I can close a window in the following way:
referenceToTheFrame.hide(); //hides the frame from view
refToTheFrame.dispose(); //disposes the frame from memory
But if I do this way, compiler complains:
Note: myProgram.java uses or overrides a deprecated API
Note: Recompile with -Xlint:deprication for details.
Do I do something unsafe?
Say I have the following code:
public class ClassToTest
{
AnotherClass anotherClass;
public void methodToTest( int x, int y )
{
int z = x + y
anotherClass.receiveSomething( z );
}
}
public class AnotherClass
{
public void receiveSomething( int z ) {.. do something.. }
}
I want to make assertion on the value of the variable z. How do I do this? Variables x, y, and z could be some other Java class types, and I just used "int" for simplicity.
Hello...
I'm trying to use JPA to connect my JSF components to database but the problem is that I can't figure out how to get this all combination works.I have done entity classes from database, also create persistence.xml file and now I don't know where to go!! I don't know how to use entity manager and entity manager factory.
Is there any tutorial helps me how to use Java EE 5,JSF 1.2 and JPA in netbeans?
any help appreciated
Thanks
In Java/C++, for example, do you casually say that 'a' is the first character of "abc", or the zeroth?
Do people say both and it's always going to be ambiguous, or is there an actual convention?
i want to write an application that sends bulk sms in java and i have a tutorial but i have to configure sms lib for me to use my modem as the port. can somehelp
Hi
I have a header field of 2 bytes where first four bits are packet type and other 12 bits are for length. but i don't know how to store this values and retrieve them.
I am using ms c++ for client and java for server. It is the client which has to set this values and server has to retrieve it.
Thanks
I have an Iterator that I use on a HashMap, and I save and load the iterator.
is there a way to get the previous key in the HashMap with Iterator? (java.util.Iterator)
Update
I save it as an attribute in a Red5 connection and then load it back to continue working where i stopped.
Another update
I'm iterating through the keyset of the HashMap
I've tried before some Eclipse plugin (I don't remember its name) but it was lacking a lot of features (generics, for example). Is there anything easy to set up that would run on the last version of Java?
Thanks
hi guys , when every one of us program in java he would need a library (some jars) to complete his work .
so when this programmer find some libraries he need . how he can find the best of these libs ?
thanks.
Hi,
I was wondering if there is a way of converting a double [][] in to a float[][] in Java?
I currently have a for loop in my code that does this and am looking for a better and cleaner way.
Any ideas would be appreciated,
Thanks,
According to the Release Notes:
All user request have an
X-AppEngine-Country header which
contains the ISO-3166-1 alpha-2
country code for the user, based on
the IP address of the client request.
My app is running on localhost with the 1.5.1 Java release which contains the X-AppEngine-Country header but I don't seem to be receiving any value for this header in my requests.
Do I have to deploy the app to a production instance to test this feature?
As we know to generate a class file there should be atleast one class or interface or an Enum should be declared in the java file.
So i was curious that is there anything else as well other the mentioned which can cause a class file generation.
Or did anybody think that as we can declare the above mentioned, we can declare this(Which you think) as well ?
I need to write a software, which launches DRM jobs in a customer environment and monitors those jobs status.
It should work with various customer environments and DRMs - like LSF, Sun Grid and others.
Can you recommend some 3rd party library, which hides DRM differences from me and has API like "launch job", "get list of jobs", "get job status" etc. ?
Both Java and native libraries are good for me.
From the java sources, it look like to drops into native code. Is the cost roughly equivalent to a volatile read or does it need to acquire a lock of some type?
I have a Java code defined as:
String[] where;
/**/where.append(ContactsContract.Contacts.HAS_PHONE_NUMBER+"=1");
/**/where.append(ContactsContract.Contacts.IN_VISIBLE_GROUP+"=1");
Those two appends are not working in this form, how would that work correctly?
hi,
I have implemented a nested class in java. And I need to call the outer class method from inner class.
//Code
class outter{
void show(){
SOP("outter show");
}
class inner{
void show(){
SOP("inner show");
}
}
}
How can I call the outter method "show".
Hi I am revising for an exam and need to know some implementation issues with the singleton pattern. they do not need to be too complex just basic things that would affect a developers decision to include them, Thanks
P.S. Could any code examples be given in Java thanks.
I have a for loop and structure like this :
for(....)
....
....
if(isTrue)
... do something..
.. method to be executed once (doTrick) is declared outside for loop.
....endif
endfor
public void doTrick()
...
...
..end
Is it possible for a method in for loop to be executed only once? I'm using JAVA
Hi guys,
I'm looking for a startup to get involved with for an equity stake. I'm a software enginner/architect with 25 years experience. I've got extensive experience with Java, C# and LAMP and have worked with serveral startups over the last couple of years.
If you're interested but would like to know more about me I can send you my resume.
Steve
Ok this situation is a bit difficult. But I am trying to embed a Java Jar into a C# form. Not as a new window or new process.
The Jar will be a game that uses the LWJGL library.
The C# Form will be a "wrapper" for it with tools and more.
Anyone have any ideas? Is this even possible?
Hello, i have some pb. I want to cast a List to Collection in java
Collection<T> collection = new Collection<T>(mylList);
but i have this error
Can not instantiate the type Collection
Hi
This was the question asked in interview.Can anybody help me out it in implementing in java
Given 2 linked lists(which need not have unique elements) find intersection point in the form of Y.(it can be anywhere--middle or tail)