Java Examples Made Easy
Ever struggled to find an example of how to use a class or API?
You may read the javadoc, JDK Tutorial,
check books, maybe even 'grep' your code base, but still can't find one. No more. JExamples makes it easy
to find high-quality example uses of Java APIs. JExamples understands the semantics of Java and performs a
search that is not only faster, but also more thorough than that performed by a text search tool, such as "grep".
JExamples Store:
Your query searches a large and growing database of Production, Open Source Java code. Each search result
shows a 5 line code preview, one preview for each source file that contains code that invokes the Class.method you specified.
The previews are sorted by user
rating. The previews help you quickly review the search results,
without having to view each source file. Click a result link to view the full source file.
Several types of queries are supported -- see
Search Help for details.
The most common query is to enter a Java Class-name and then press Search.
JExamples Compared to Competing Tools
There is an important difference between JExamples and most of the 'other guys' and that is that JExamples
understands the Java language and uses that knowledge to perform your search. This is similar to the difference
between refactoring technology and search and replace. Thus, our searches are much
more than just an intelligent 'grep'. JExamples knowledge of Java allows
us to support features like:
- Accurate results. The examples provided are accurate and will not include common issues with
string matches in comments or for classes with the same name in different packages.
- You can Rate examples. We order your search results based on those community ratings, so the best ones come first.
- We recognize and tell you if you search for a class name that is ambiguous (class with same name lives in multiple packages).
- If you search for just a Class-name, we will show you a list of all methods on that class that we have examples for.
- We support 'Did you mean' query corrections, which help you catch spelling errors in a class or method name.
Source Files
If you click the link to view the source file, you will see the complete source file,
as distributed by the open source project, without modification except for the color-coding of keywords to aid readability.
There can be other examples of the API you queried for within that same source file -- a table at the top
of the page shows them all and has links that will jump you to them.
Open Source Products
"Production-Quality Java Examples"
All open source products in our database
are shown on our
Database Content page. This list is still growing and we keep an
eye on queries that return 0 rows to get ideas about what to add next. But if you find a hole in our
API coverage and also happen to know an open source
product you like that uses that API, then please let us know.
Contribute
If you know of an open source project which would be a good addition to our
product set, please consider helping add this project by sending an
e-mail with
the following information:
- Name of the project
- URL for the project
- Link to the license information
In addition to the above information, a source and class archive
will be requested later in a specific format.
Example Rating
Shows how users rate this particular example. In the source files, you are allowed to Rate individual
examples (must have browser cookies enabled). The search results are
ordered by this Rating,
and the highest rated examples come first.
The first number in the Rating tells what percentage of users said the example is useful and the second tells how many users
have rated it. Thus, a rating of "60% of 100" would mean that 100 users have rated the example, with 60% of those
users voting that it was helpful and 40% voting that it was not helpful.
Search Result Order
Search Results are ordered by the example
Rating percentage and the highest rated examples come first. For
example, since 80% is greater than 70%, an example with the rating "80% of 10" would come before one with rating "70% of 20".
Also note that an example with a 50% rating will sort the same as an unrated example (one with rating "0% of 0").
Complexity
Represents the level of complexity of the method in which the example lives. We make a
cyclomatic complexity measurement
of every method when we analyze the code and map our complexity
measurements to one of 3 values: low, medium, and high, represented by the numbers 1, 2 and 3. You can also specify a
complexity
clause in your queries if you want to see only examples in methods of a particular complexity.
C1 - Complexity 1 (low).
C2 - Complexity 2 (medium).
C3 - Complexity 3 (high).
News
Log of past
java examples news.