Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

siraj siddiqui

Greenhorn
+ Follow
since Dec 05, 2008
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by siraj siddiqui

Can you provide any sample code or tutorial for this class HTMLEditorKit.InsertHTMLTextAction ?
10 years ago
In jdk following class is there

public static class HTMLEditorKit.InsertHTMLTextAction
extends HTMLEditorKit.HTMLTextAction

it says

InsertHTMLTextAction can be used to insert an arbitrary string of HTML into an existing HTML document. At least two HTML.Tags need to be supplied. The first Tag, parentTag, identifies the parent in the document to add the elements to. The second tag, addTag, identifies the first tag that should be added to the document as seen in the HTML string. One important thing to remember, is that the parser is going to generate all the appropriate tags, even if they aren't in the HTML string passed in.

For example, lets say you wanted to create an action to insert a table into the body. The parentTag would be HTML.Tag.BODY, addTag would be HTML.Tag.TABLE, and the string could be something like
.

There is also an option to supply an alternate parentTag and addTag. These will be checked for if there is no parentTag at offset.

I do not understand this , will you explain ?
10 years ago
hi friends,
I want to know , Can we add an html tag from applet to the html file in which applete is
is running ? If yes , then how ?
10 years ago
Sorry Deepak but i have not invertared the sentence.Imfact that is what i have in javadocs[1.6]

The second add operation will return true (and the size of the tree set will increase) because a and b are not equivalent from the tree set's perspective, even though this is contrary to the specification of the Set.add method.
Deepak i think there is some mistake in the quote that you have posted.
Here is the quote that you have posted

"Caution should be exercised when using a comparator capable of imposing an ordering inconsistent with equals to order a sorted set (or sorted map). Suppose a sorted set (or sorted map) with an explicit Comparator c is used with elements (or keys) drawn from a set S. If the ordering imposed by c on S is inconsistent with equals, the sorted set (or sorted map) will behave "strangely." In particular the sorted set (or sorted map) will violate the general contract for set (or map), which is defined in terms of equals.

For example, if one adds two keys a and b such that (a.equals((Object)b) && c.compare((Object)a, (Object)b) != 0) to a sorted set with comparator c, the second add operation will return false (and the size of the sorted set will not increase) because a and b are equivalent from the sorted set's perspective."

But when i saw the comparator interface in the java docs it is like this

" Caution should be exercised when using a comparator capable of imposing an ordering inconsistent with equals to order a sorted set (or sorted map). Suppose a sorted set (or sorted map) with an explicit comparator c is used with elements (or keys) drawn from a set S. If the ordering imposed by c on S is inconsistent with equals, the sorted set (or sorted map) will behave "strangely." In particular the sorted set (or sorted map) will violate the general contract for set (or map), which is defined in terms of equals.

For example, suppose one adds two elements a and b such that (a.equals(b) && c.compare(a, b) != 0) to an empty TreeSet with comparator c. The second add operation will return true (and the size of the tree set will increase) because a and b are not equivalent from the tree set's perspective, even though this is contrary to the specification of the Set.add method."
Deepak & Ankit thanks for the information. But i still have a doubt.
Will you explain,
Why HashMap do not use the hashcode value as a key and actual object as a value.
HashSet uses HashMap internally to store objects.
you are saying

HashSet<String> names = new HashSet<String>();
names.add("Deepak");

when you add object("Deepak") internall it is stored in HashMap where
key is "Deepak" & value is dummy object
But when you iterate through Hashset means internally you are iterating thtough HashMap.In HashMap key is "Deepak" & value is dummy object, so it should return dummy object rather than key i.e. "Deepak" . So you are getting dummy object out of the HashSet not orignal object ("Deepak").

I am not getting your point ,Will you explain please?
UEW
Actully i have seen this question on http://www.ratedprofiles.com
and there the correct answer given was...
it will print three
UEW
What is the output of following code ?

1. public static void main(String[] args) {
2. Integer i = uew Integer(1) + new Integer(2);
3. switch(i) {
4. case 3: System.out.println("three"); break;
5. default: System.out.println("other"); break;
6. }
7. }

Here i do not understand the "uew" , what is it ?
What is the output of following code ?

1. public static void main(String[] args) {
2. Integer i = uew Integer(1) + new Integer(2);
3. switch(i) {
4. case 3: System.out.println("three"); break;
5. default: System.out.println("other"); break;
6. }
7. }

Here i do not understand the "uew" ,what is it ?
11 years ago
Can we extend inner class ? If yes then how ?