This question already has answers here:
What is the need of collection framework in java?
(10 answers)
Closed 7 years ago.
Actually I am learning Java and stuck on "Collection" . Can any body explain what does it mean by :-"Collection is a frame work" . I am a bit confused . Is it a pre-written programmes? is it a environment to build project. Kindly explain. Your help would be highly appreciable.
"Collection is a Framework" is incorrect, but you can see how someone would make that mistake.
Java has the Collections framework, which is a group of classes and interfaces provided by the JDK that handle collections of things like lists and maps and sets. They're in the java.util package (along with a bunch of other things that aren't part of the Collections framework).
More about the collections framework in this tutorial.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
i have read the following post
Oracle Discontinuing sun.reflect.Reflection.getCallerClass
i was wondering what this change really means.
1). Means that this class sun.reflect.Reflection.getCallerClass will be rewritten to provide more security in Java reflection?
2). Means this class will no more be needed? maybe another approach?
3). Reflection will be over in Java 8. method.invoke will throw UnsupportedOperationException.??
4). this will affect anything related to Spring or AspectJ Aspect Oriented Programming?
i was wondering because we use Reflection method.invoke to provide some flags to the class before being send to the DB. this raises another question if reflection is over what approach can i use to provide my behavior above. i think AOP is a way to go.
thanks a lot.
Short answer: you only need to worry if you use sun.reflect.Reflection.getCallerClass. (And it is ludicrous to suggest that Java reflection is being withdrawn.)
A longer answer is that the functionality provided by that method is being reworked in JEP 176. The old method is actually being removed ... not just deprecated. It is a method in the sun.* tree, and application code should not be calling it directly. The current plan seems to be:
to remove this functionality entirely if no valid use cases can be identified, or
provide a replacement API, or at least defer the hard removal of the current method from Java 7
The original primary use-case for this private API was for security managers and the like that needed to know who called them. Unfortunately, this approach has proven to be fragile. A new approach to that problem (using message handles) has been designed. Rather than leaving this API in place for application code to use willy-nilly for dubious purposes, they have decided to force the issue.
However, there are signs of push-back on this issue because it is causing breakages in things like Groovy and JRuby.
References:
This message thread: http://www.mail-archive.com/mlvm-dev#openjdk.java.net/msg05325.html
Your specific questions:
1). Means that this class sun.reflect.Reflection.getCallerClass will be rewritten to provide more security in Java reflection?
See above. I suspect that there is a security related motivation for this.
UPDATE - This confirms it: https://partners.immunityinc.com/idocs/Java%20MBeanInstantiator.findClass%200day%20Analysis.pdf
2). Means this class will no more be needed? maybe another approach?
See above. They haven't yet determined whether the functionality is needed.
3). Reflection will be over in Java 8. method.invoke will throw UnsupportedOperationException.??
No to both of these. This is just about a specific method of a specific class in the sun.* packages.
It does not impact on reflection in general or on method.invoke().
4). this will affect anything related to Spring or AspectJ Aspect Oriented Programming?
Probably not. It would only affect those technologies if they relied on that particular method. If they do, then the respective library maintainers will need to ensure that the Java team are aware of the use-cases that require this. I imagine the maintainers are tracking this.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
What is the difference between a framework and a library?
Java documentation says The collections framework
Why is java collections called a framework and not a library?
Now I am more confused about what I can expect from a framework as to a library..
The following characteristics differentiate Frameworks from libraries:
inversion of control - In a framework, unlike in libraries or normal user applications, the overall program's flow of control is not dictated by the caller, but by the framework.
default behavior - A framework has a default behavior. This default behavior must actually be some useful behavior and not a series of no-ops.
extensibility - A framework can be extended by the user usually by selective overriding or specialized by user code providing specific functionality.
non-modifiable framework code - The framework code, in general, is not allowed to be modified. Users can extend the framework, but not modify its code.
Basically a framework is a type of a library whose behavior cannot be changed. For instance, you can extend class ArrayList or HashMap in java, but you cannot change the behavior of those classes.
This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
places where Java Beans used?
Can anyone tell me what exactly "Java beans" is and why is it used?
Links
Wikipedia/JavaBean
java.sun.com - Developer - Online Training - Introducing Java Beans
I do not like the term java bean, it just causes confusion because every properly written java class is per definition a java bean, that is, using proper encapsulation rules and so on.
But take care, sometimes people who are saying java bean, mean enterprise java bean (EJB) which is are classes which derive from special classes in the java EE framework.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I always asked myself if it would be possible to make a Java to C++ converter.
Maybe a tool that converts the Java syntax to the C++ syntax?
I am aware that the languages differ, but simple things like loops where the semantics match 1 to 1.
Is there such a tool? Or is it possible to make one?
It's possible to do anything given enough time, money and resources. Is it practical? Beyond trivial examples not really. Or rather it depends on what constitutes an acceptable error rate.
The real problem is that the idioms are different in Java to C++. Java to C# for example would actually be far easier (because the idioms are much more similar). The biggest of course is that C++ has destructors and manually managed memory. Java uses finally blocks for this kind of behaviour and has garbage collection.
Also Java has a common Object supertype. C++ doesn't.
The generics to templates would be nigh on impossible I would imagine.
The Firefox HTML5 parser is written in Java and converted to C++. But I think the converter used there is quite specific for this project. Interestingly, it turned out the resulting C++ parser was faster than the old parser written in C++.
I'm also writing a converter as part of the H2 database, under src/tools/org/h2/java. The idea is to allow converting a subset of the H2 database to C++, so this is also not a general purpose translater.
And there is the open source project J2C.
So there are ways to convert Java to C++. But don't expect the translator support all features, and don't expect the resulting code to be any faster than a good Java JVM.
Is is possible, no question, but it won't be so simple. It would be a Java compiler which generates C++.
If you want to do that from scratch, it will be very hard, you have to do all the work javac and the JVM do for you (e.g. garbage collection).
Btw. Google has a Java to JavaScript compiler (included in GWT)
There is one, bit I am not sure if it actually works.
Java to C++ Converter-Tangible Software Soulutions.
It is weird how there are c++ to java converters, but only 1 java to c++ converter.
As said it would be tough to convert Java to C++ but we can have an applicaiton or tool that generates code in Java and equivalnet C++ code.
I know one applicaiton which generates code in C++/Java/C# given a model which has its own way to deifine it.
That tool belongs to CA and name is CA Plex.
Search on www.ca.com
There are programs out there that claim they can do this, but none have gained enough popularity to be frequently mentioned, so we'll leave them at "attempts". Making a converter would require a lot of AI built into your program. The difficulty is increased tenfold when swing is involved because GTK/wxWidgets/Qt/win32 API all differ greatly from swing. But it is possible. Not that the code quality will be great, and no guarantees your program won't crash due to separate memory handling methods, but it's possible.
The main issue is that java is a language that is written and designed to talk to a VM. I suppose it would be possible, but all you would be left is a very poorly optimized application with a self translating layer doing what the VM already does. I mean, sure, it is possible, it still wouldn't be a solution for anything i could think of. If your looking to make your sluggish java app native, maybe your thinking too hard, just use an application like JET, its actually quite good, and will give you the benefits a native app would bring. Of course if the VM is already doing what the app is asking it to do just as well as native code could(it happens.. sometimes :P) it might change nothing.
Java to c#, tho, sounds more reasonable, as both the languages are written in similar ways, talking to a framework as such, but this would still leave code very much unoptimized as code written from scratch for a particular framework can not be bested.
http://www.tangiblesoftwaresolutions.com/Order/Order_Upgrade_Instant_CPlus_Java_Edition.htm
Depends on the domain of where the code will be used, from a learning perspective perhaps it might be interesting.
i just found this via a google as I remembered seeing one in Univeristy that created code based on uml.
Java to C would actually be the easiest. Remember you need to convert the language, If you do that, the required libraries can be converted by your new compiler. In other words Swing and AWT should not be a big problem...
I would start by taking a good look at the Java Native Interface (JNI). The JNI is a part of java which allows it to be used with C and C++. The reason I would start here is that it becomes fairly obvious how parts of Java may be implemented in C. Once I had a grasp on basic structures, like how Java Objects can be mapped onto C structures (struct) and how pretty much everything in Java is an Object including arrays, I might peek at the Open JDK source code.
The actual converter would have to convert all the imported Java libraries (and their imported libraries and so on...) which means you would need the source code for everything. This conversion no small task since the Java libraries are large.
The process would be time consuming, but no AI should be required. However, I see no reason to perform a conversion like this. It looses the portability of Java and would not gain the efficiency of C (except that it would be compiled to native code, but it would be better to compile the machine code directly from the Java).
Something neat would be a tool , that translate java to "C++ using Java API" (like GNU GCJ CNI), one problem remain is to manage array.length (array not vector) ...