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, I am just learning Java and am trying to get my program to retrieve the first digit of a number - for example 543 should return 5, etc. I thought to convert to a string, but I am not sure how I can convert it back? Thanks for any help.
int number = 534;
String numberString = Integer.toString(number);
char firstLetterChar = numberString.charAt(0);
int firstDigit = ????
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
How can i write 'one bit' into a file stream or file structure each time? is it possible to write to a queue and then flush it ? is it possible with c# or java?
this was needed when i try to implement an instance of Huffman codding. i can't write bits into files. so write them to a bitset and then (when compression was completed) write 8-bit piece of it each time (exclude last one).
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
https://twitter.com/sessions?authenticity_token=b1b43178e09c1e6ccec1b3183f1f139f39643aaf&session%5Busername_or_email%5D=ddddd&session%5Bpassword%5D=rrrrr&q=&site_action=https%3A%2F%2Ftwitter.com%2Fsessions&serialized_string=Hello
why is this url throwing a java.net.MalformedURLException??
I'm having a session object that does NOT implement the java.lang.Serializable. (its a legacy application, and now I can't go and change the code)
Is there any way where I can store the session object some where and later GET BACK THE SAME STATE in a STANDALONE application.
One thought is to use RMI. Is there any better way of achieving this.
Thank you :)
Should it be all fields, including super-fields, of a purposively immutable java class 'final' in order to be thread-safe or is it enough to have no modifier methods?
Suppose I have a POJO with non-final fields where all fields are type of some immutable class. This POJO has getters-setters, and a constructor wich sets some initial value. If I extend this POJO with knocking out modifier methods, thus making it immutable, will extension class be thread-safe?
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.
Given: LDAP stores location of users.
How do I drive their timezones using their location? Any pointers are accepted, Java language preferred.
Thanks in advance.
Hello, I'm trying to figure out the right way to read lucene index only once whilst running the application multiple times, how can I do that in java?
Because indexed data will not change so reading them each time would not be necessary. Can someone explain me the logic of it reading them only once? thank you
Is it possible in Java to draw shapes and stuff directly on the screen so my desktop remains visible and I can click whatever is underneath my shape? I'm using Windows XP. 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,
Hello,
I have written a webservice which is taking URL as an input and producing a JSON respone. My problem is that now I have list of 1000 URLs and want to execute maximum threads of Webapplications to get output. Like I want to execute 100 instances of webservice at a time to get response.Please can anybody give some guidance how can I do it using java.
Thank you in advance
I have an application which uses UDP connection, now when i try to run the app more than once its throwing me an exception
java.net.BindException: Address already in use: Cannot bind
but in my another app, which uses tcp connection, i can open two instance of the same app and its working fine. why this error only with UDP connection?
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
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?
Hello, Im searching for ideas to solve the following problem:
I'm loading an URL (any for that matter) into an iFrame, and then block (server side) all image tags, o object tags before sending the page to the client.
--
What I was thinking to do is: fetching the URL, and then manipulating the fetched content using a Java library (any recomendation on that matter?). And after that, send the modify content to que client.
Would that be the best approach to solve this problem? suggestions are wellcome :)
What regular expression using java could be used to filter out dashes '-' and open close round brackets from a string representing phone numbers...
so that (234) 887-9999 should give 2348879999
and similarly 234-887-9999 should give 2348879999.
Thanks,
The compiler does not consider return
type when differentiating methods, so
you cannot declare two methods with
the same signature even if they have a
different return type.
Java Tutorial
Why is this?
I was wondering if there is a 'smooth way' of redeploying a Java WAR to a production server (no cluster, no OSGi)?
All I can come up with is stop server, update file, restart server. And 10 minutes beforehand I need to display a maintenance warning on the site.
What's your approach?
Hi
I am trying to compare the performance of Single and Multithreaded Java programs. Are there any single thread benchmarks which are available which I could then use and convert to their multithreaded version and compare the performance. Could anybody guide me as to what kind of programs(not very small) are suitable for this empirical comparison.
Thanks in advance
I'm using generics rather long time but I've never used construction like List<? super T>.
What does it mean? How to use it? How does it look after erasure?
I also wonder: is it something standard in generic programming (template programming?) or it's just a java 'invention'? Does c#, for example, allow similar constructions?
Consider you have the following class
public class OuterClass {
...
private static class InnerClass {
int foo;
int bar;
}
}
I think I've read somewhere (but not the official Java Tutorial) that if I would declare the static member classes attributes private, the compiler had to generate some sort of accessor methods so that the outer class can actually access the static member class's (which is effectively a package-private top level class) attributes.
Any ideas on that?