Data dodania Pytanie
2017-01-01 22:01 Benefits of Using Generics in a Base Class that Also Implement the Same Class »
I recently ran across this scenario in code that I didn't write and while there may be some design benefit to this approach, I can't seem to squeeze t...
(3) odpowiedzi
2017-01-01 18:01 Retry once using functional interface »
I'm new to functional programming (and Java) and I want to create something nice using it, but cannot figure out how. I'm using BiConsumer (java.util...
(0) odpowiedzi
2017-01-01 11:01 Java Infinite while Loop - float 123456789 »
I am currently learnig java float-point numbers. I know, that a float have a specific amount of significant digets. I also know, that a float is repre...
(1) odpowiedzi
2017-01-01 00:01 Java8 - idiomatic way to process a Stream<Callable<...>> in parallel delivering to a sequential consumer? »
Suppose I have a Stream<Callable<SomeClass>> stream;. The stream is accessing over a million objects which will not fit in memory. What i...
(4) odpowiedzi
2016-12-31 21:12 Java List Horrible Adding Performance »
I'm adding millions of entries of a custom object to a List. This turns out to be very slow and the graphical user interface keeps freezing randomly a...
(1) odpowiedzi
2016-12-31 19:12 Java program runs slower when code that is never executed is commented out »
I observed some strange behaviour in one of my Java programs. I have tried to strip the code down as much as possible while still being able to replic...
(3) odpowiedzi
2016-12-31 19:12 I try to upload image to imgur via code but I get 400 Bad Request, why and how can I fix? »
I try to make a code that uploads automatically image to imgur Here is my code: File image = new File("[image path]"); FileInputStream fis = ...
(0) odpowiedzi
2016-12-31 17:12 Will a Timer on Android scheduled to execute every second work during a leap second? »
Supposing I have a timer running in an Activity on Android (say, Android 6.0, in case it matters). Timer timer = new Timer(); timer.schedule(timerTas...
(1) odpowiedzi
2016-12-31 09:12 Deserialization of JavaScript array to Java LinkedHashSet using Jackson and Spring doesn't remove duplicates »
Let's say I have this client-side JSON input: { id: "5", types: [ {id: "1", types:[]}, {id: "2", types:[]}, {id: "1", types[]...
(3) odpowiedzi
2016-12-31 05:12 Uploading a String Array of dates into oracle »
I keep getting the following error when I try to upload my books table through eclipse: java.sql.SQLSyntaxErrorException: ORA-01722: invalid number ...
(1) odpowiedzi
2016-12-30 20:12 Replace certain words in a sentence »
I'm developing an app in Android Studio that translates certain words that I've made up myself. I've got the part in the code that translates the word...
(3) odpowiedzi
2016-12-30 11:12 Reading multiple integers in multiple lines »
I am currently writing my Bachelor's thesis in graph theory and use the java scanner to convert a txt file with edges into my Java class graph. My txt...
(4) odpowiedzi
2016-12-30 10:12 Why UTF-8 is used in class file and UTF-16 in in runtime? »
Why .class is UTF-8, but runtime .class is UTF-16? ...
(3) odpowiedzi
2016-12-30 10:12 Why does the ExecutorService interface not implement AutoCloseable? »
Failing to call shutdown() on a thread executor will result in a never terminating application. Best practice to shut down the ExecutorService is this...
(4) odpowiedzi
2016-12-29 15:12 java-9 weakCompareAndSwap vs compareAndSwap »
This question is not about the difference between them - I know what spurious failure is and why it happens on LL/SC. My question is if I'm on intel x...
(2) odpowiedzi
2016-12-29 14:12 Create Delete Dialog on selected piechart value? »
I created this android app using the MPAndroidChart Library, which allows the user to create a quick PieChart using an ArrayList (I added some screens...
(1) odpowiedzi
2016-12-29 14:12 How to apply test functions to genetic algorithm »
I have written following code for population evolution (Genetic Algorithm Implementation): Individual.java import java.util.Random; public class In...
(1) odpowiedzi
2016-12-29 06:12 How to check whether string enter by user is in mm/dd/yyyy format in android? »
There is one text edit in my app that the user can enter a date in the format mm/dd/yyyy. I have to check whether entered value is in mm/dd/yyyy forma...
(5) odpowiedzi
2016-12-29 02:12 Why is a class called an abstraction of an object? »
I understand that a class is essentially a blueprint of an object, but the idea that a class is an 'abstraction' of an object is a little hard for me ...
(3) odpowiedzi
2016-12-29 00:12 Whats the performance cost on iterating on a list multiple times »
I have a List I need to iterate through and perform work on along the way. My problem is that, for my program, its difficult to do all the work needed...
(5) odpowiedzi
2016-12-28 23:12 In Javadocs, how should I write plural forms of singular Objects in <code> tags? »
I have a class named Identity. In my javadoc comments I am referencing it as a plural. I can think of two solutions: change the reference to <code&...
(3) odpowiedzi
2016-12-28 16:12 Create criteria statement, get the result and the row count with one query »
I'm trying to fetch results and also the row count inside a single query for pagination. This is what I got so far: public List<User> getUser...
(0) odpowiedzi
2016-12-28 11:12 What to return when generic methods returns 'nothing' but null can't be returned? »
Suppose I have a library method like this (very abbreviated): public static <V> Optional<V> doSomethingWith(Callable<V> callable) {...
(4) odpowiedzi
2016-12-28 09:12 Creating Objects exclusively with Factory »
I'm currently working on a student project and wondering if there is a way to create objects exclusively with factory methods? public class PersonFac...
(4) odpowiedzi
2016-12-28 09:12 importing a library as a package private »
I know we can create a package private class in java. So the class is Internal and only accessible in the specified module: class MyPackagePrivateCla...
(3) odpowiedzi
2016-12-27 19:12 java9 intrinsic method unclear »
Suppose I have this code (it really does not matter I think, but just in case here it is): public class AtomicJDK9 { static AtomicInteger ai = ...
(1) odpowiedzi
2016-12-27 15:12 Is Stream.count() guranteed to visit each element? »
In other words, is the following line guranteed to print num lines? int num = list.stream().peek(System.out::println).count(); This question was tr...
(1) odpowiedzi
2016-12-27 12:12 How do negative operands to bitwise operators work in Java? »
-4 & -5 = -8 // How? -4 & 5 = 4 // How? I need an explanation for how the above results can be reached. I have no difficulties in solving wi...
(2) odpowiedzi
2016-12-27 11:12 Pure functions and Java »
I have several doubts about Java and pure functions. As far as I know, a pure function is a function for which these two statements hold: No side-ef...
(1) odpowiedzi
2016-12-26 12:12 Open multiple images in gallery intent »
I need to open multiple images in gallery to view by sliding... I know how to open 1 image.. Intent intent = new Intent(); intent.setAction(Intent.AC...
(3) odpowiedzi
2016-12-26 11:12 How to retrieve the elements of HashSet using Struts2 tag without using s:iterator »
I am using Struts2. Please help me in understanding how to retrieve the elements of HashSet using Struts2 tag without using Struts iterator tag. str...
(3) odpowiedzi
2016-12-26 10:12 Which tree type used in java 8 HashMap bucket? »
As I know in java8 HashMap bucket implementation was changed a bit. If bucket size exceeds some value then list transforms to the "balanced tree". I ...
(1) odpowiedzi
2016-12-26 10:12 Scala @specialized annotation infinite recursion? »
Version: scala 2.11.8 I defined a class with specialized type and override method in inheritance: class Father[@specialized(Int) A]{ def get(from:...
(1) odpowiedzi
2016-12-25 21:12 Why is BufferedReader read() much slower than readLine()? »
I need to read a file one character at a time and I'm using the read() method from BufferedReader. * I found that read() is about 10x slower than rea...
(5) odpowiedzi
2016-12-25 19:12 Use Python regex to parse string of floats output by Java Arrays.deepToString »
I'm working with someone's Java code where a key data structure is a m x n x p array, float[][][]. I need to get it into Python; currently my approach...
(2) odpowiedzi