How to use "put" function in Java.util.Map class
intially an entry for key is null in a Map.
then if I try to do put function on the map with the same key which had a null value previously It doesn't allow me to put the new value for the Key.
Can anyone pleasee suggest as to how I can put a value on to key with the new value even if the old value is null.
Waiting for replies
I have problem with the "value"..Not with a "key"
parameter in the function.I already have a value for
Key...that is "Firstkey"
Map map = new HashMap();
String column = "FirstKey";
map.put(column, null);
The below step gives me an IllegalArgumentException
map.put(column, "FirstValue");That's not the problem. Your error is somewhere else.
This works.
public class Test {
public static void main(String[] args) {
Map map = new HashMap();
String column = "FirstKey";
map.put(column, null);
map.put(column, "FirstValue");
System.out.println("Done");
}Kaj
Similar Messages
-
How to Use DLL Function in Java Applet
Hi all,
I have been assigned a task to develop java applet. The problem is, I need to use DLL functions in my applet to read records. Could you pls anyone guide me how to interface DLL and applet to read records with sample code?
I'm using JDK 1.5.0_06 and Windows XP OS. thanx..
best rgds,
jpdbayYou will need to use Java Native Interface JNI. Ther are many posts on the subject, please search, and this is the documentation:
http://java.sun.com/j2se/1.5.0/docs/guide/jni/spec/jniTOC.html -
How to Use Exec function in Java Code
How to Use Exec method
I want to Execute command
net Start "some service"
using exec method of runtime class
or i use some other way if suggestAssuming you have read http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html#exec(java.lang.String) already, I can only suggest to be more specific in what your problems are. If you are after just some example code, then download ftp://ftp.ebi.ac.uk/pub/software/textmining/monq/monq.tar.gz and have a look at the source code of monq.stuff.Exec. It does all those things which are necessary to keep track of a Process after it was created with exec.
Harald.
BioMed Information Extraction: http://www.ebi.ac.uk/Rebholz-srv/whatizit -
How to use print functionality in Java Studio Creator
Hi,
I am working on one JSF project using Java Studio Creator.
I have requirement where I have one table and print button.
By clicking the print button, I want the contents of table to be printed.
I have configured all the required properties of this button but still by clicking this print button, I am not able to see the print window.
Please help me in that, Its urgent.
Thanks in advance.
VijayHi,
i think the best thing for you to do is to use javascript. go to jsp page of the form and find the button, as part of its attribute type onClick="window.print()" -
Java.util.map in a jar?
My applet works on Netscape 6.1 presumably because the java.util.map class has capabilities that I'm using in my applet that isn't in other versions of java.util.map. Since I want to make my applet cross platform, is there any way to include java.util.map in my jar file so that people can use that version instead? Thanks.
DeniseDenise,
I think that will break your license agreement with Sun, so you probably don't want to do that, right? ;)
I think you should try to figure out what the exact cause of your problem is. Off hand, it almost sounds like your applet uses v1.3 api, but your still using the old <Applet> html tag and not the new <Object> tag. Is this right?
-Ron -
How to use data function using characterstics variable for calculation on
how to use data function using characterstics variable for calculation on attribute as key figure
Hi Gayatri
Did you not see my answer for CASE because CASE does indeed offer the use of the BETWEEN clause, but DECODE does not. Let me give you a little synopsis of DECODE.
In its most simple form it takes 4 values and looks like this: DECODE(A, B, C, D)
This essentially means, IF A = B THEN C ELSE D
The trick to solving BETWEEN in a DECODE is to work out algoriths where A = B. Because we don't know how many values are between 00 and 99, although I could guess there were 100 we could of course have 100 parts in the DECODE but that would be awful. How about if we look at it another way and say this:
IF PART_NUMBER < 'SDK00' THEN pay_amount
ELSE IF PART_NUMBER > 'SDK99' THEN pay_AMOUNT
ELSE pay_amount + 100
This statement only had 2 hard coded values, but how to make DECODE work with less than? Easy, we use the LEAST function. The LEAST function takes 2 values and returns the one with the lowest value. So I use LEAST(PART_NUMBER, 'SDK00') then whenever the PART_NUMBER is lower than SDK00 it will be true. A similar situation exists for the opposite function GREATEST. Putting all of this together then, you can do this:
DECODE(PART_NUMBER, GREATEST(PART_NUMBER, 'SDK00'), DECODE(PART_NUMBER, LEAST(PART_NUMBER, 'SDK99'), PAY_AMOUNT * 100, PAY_AMOUNT), PAY_AMOUNT)
In English this can be read as follows:
IF the PART_NUMBER is greater than or equal to SDK00 and the PART_NUMBER is less than or equal to SDK99 THEN PAY_AMOUNT x 100 ELSE 0
Best wishes
Michael -
How to use email function in crystal report ?
Post Author: kudo
CA Forum: .NET
Hi I'm a novice by touching .net not more than 2 months. Can somebody guide me how to use email function provided in crystal report components?(Better put a sample code so that I can understand well.) ps: I'm using VS2005 VB.net.Thanks.Post Author: mewdied
CA Forum: .NET
'EXPORT to EMAIL ''' Code for exporting the report to Mapi (.Net Windows application) ''' *For a Web application you must export to disk as a PDF file first.
crReportDocument.Load(Application.StartupPath + "\World Sales Report.rpt") crMicrosoftMailDestinationOptions = New MicrosoftMailDestinationOptions With crMicrosoftMailDestinationOptions .MailCCList = "[email protected]" .MailToList = "[email protected]" .MailSubject = "Attached exported report" .UserName = "admin" .Password = "password" End With
crExportOptions = crReportDocument.ExportOptions With crExportOptions .DestinationOptions = crMicrosoftMailDestinationOptions .ExportDestinationType = ExportDestinationType.MicrosoftMail .ExportFormatType = ExportFormatType.PortableDocFormat End With
'Add some error handling Try crReportDocument.Export() MsgBox("Report exported successfully.") Catch err As Exception MessageBox.Show(err.ToString()) End Try
Hope this helps -
How to use XML / XPath in JAVA (in 1.4)
I'm absolutely novice in XML
but I need to query XML using XPath
As I understand XPath become avalible only in Java 1.5
But I use 1.4 (project requirement)
Which third part component could you recomend?Can anyone help me with this XPath query
I get result [title: null]
import java.io.*;
import javax.xml.parsers.*;
import org.xml.sax.*;
import org.w3c.dom.*;
import org.jaxen.*;
import org.jaxen.dom.*;
import org.jaxen.saxpath.*;
import java.util.*;
public class TestX {
public void ggg() {
try {
File f = new File("journal.xml");
DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
org.w3c.dom.Document doc = docBuilder.parse(f);
XPath xpath = new DOMXPath( "/journal/article/title" );
List result = (List) xpath.evaluate(doc);
System.out.println(result.get(0));
} catch (Exception e) {
e.printStackTrace();
public static void main(String[] args) {
TestX tx = new TestX();
tx.ggg();
}journal.xml
<journal>
<article id="article.1">
<title>Art1</title>
<author>
<first>Bob</first>
<last>McWhirter</last>
</author>
<text>
</text>
</article>
<article id="article.2">
<title>Art2</title>
<author>
<first>James</first>
<last>Strachan</last>
</author>
<text>
</text>
</article>
</journal> -
How to use read_text function module
Hi how to use read_text function module to read purchase order header text .what are all tht things to pass in ID,Name and Object
thanks,
MaheDear,
Use below code.
DATA:IT_LINE LIKE TLINE OCCURS 0 WITH HEADER LINE,
V_TDNAME LIKE THEAD-TDNAME.
V_TDNAME = PO_NUMBER.
CALL FUNCTION 'READ_TEXT'
EXPORTING
* CLIENT = SY-MANDT
ID = 'F01'
LANGUAGE = 'EN'
NAME = V_TDNAME
OBJECT = 'EKKO'
TABLES
LINES = IT_LINE.
Thanks and Regards, -
How to use standard function keys as custom keys
how to use standard function keys as custom keys.
i have encountered that problem while developing a screen, there i'm supposed to use standard function key F2 ( which actually meant for choose) for clearing the screen fields where the cursor is present and f1 for saving data that entered in screen fields, etc...
kindly help me out.Hi ,
Solution to use SAP reserve function keys F1 .. F4 (mostly this requirement comes up for RF screens) can be acheived by assigning your new Function code using the Menu path Utilities --> F key Consistency in the Menu Painter (SE41) . Once you assign your cutom function code to the standard Fn keys the only remaining step is to make sure that you set a curson on any of the field on sceen by using the Key Word "SET CURSOR" .
If you dont use the key word SET CURSOR in the PBO of the screen then you might not see any response for F4.
Thanks -
How to use sql query in java ?
i don't know how to use sql query in java code.
who can give me some advice?
thankshttp://java.sun.com/developer/onlineTraining/Database/JDBC20Intro/
-
How to use SQL functions in the queries
hey guys i wanna know how to use SQL functions in the queries is it possible or not .
Hi,
Wat exactly that set values are?
those from sql query?
How to use count():
The COUNT() function returns the number of rows that matches a specified criteria.
SQL COUNT(column_name) Syntax
The COUNT(column_name) function returns the number of values (NULL values will not be counted) of the specified column:
SELECT COUNT(column_name) FROM table_name
SQL COUNT(*) Syntax
The COUNT(*) function returns the number of records in a table:
SELECT COUNT(*) FROM table_name
SQL COUNT(DISTINCT column_name) Syntax
The COUNT(DISTINCT column_name) function returns the number of distinct values of the specified column:
SELECT COUNT(DISTINCT column_name) FROM table_name
The IN function helps reduce the need to use multiple OR conditions.
The syntax for the IN function is:
SELECT columns
FROM tables
WHERE column1 in (value1, value2, .... value_n); -
How to use this function in crm5.2 - /CEM/ENT_IMPORT_DATAFROMEXCEL
i am having a problem regarding how to use this function to import values from an excel sheet.
in call funtion what to specify at place of ct_ent_action = ?
CALL FUNCTION '/CEM/ENT_IMPORT_DATAFROMEXCEL'
CHANGING
CT_ENT_ACTION =
EXCEPTIONS
FILE_ERROR = 1
IMPORT_ERROR = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.Hi
The use of Standard Parner functions are as follows:
1. Ordering Address (OA): The PO will be sent this vendor and not the main vendor.
2. Goods Supplier (WL): In case of return deliveries, Goods will be returned to thsi vendor's address
3. Invoicing party (RS): The payment will be made to this vendor.
Hope this clarifies.
Thansk -
How to use these function modules
Hi all,
can anyone help that how to use these Function modules to update the status of a task, what are all the inputs i required to proceed
1. FC_USER_AUTHORITY_CHECK
<b>2. FC_USER_STATUS_CHECK
3. FC_USER_STATUS_UPDATE</b>
4. FC_USER_GET_CACTI
5. FC_USER_CHECK_FOR_OUTPUT
Thanks in Advance
GaneshHi Rob,
thanks for ur reply,
but they are not clear what they are meant to be, I understood there are some flags needed to run the Function Modules 2 & 3 which are in bold...
but how do i populate them.. i am not getting that..
thanks
ganesh -
How to use BAPI_MATERIAL_AVAILABILITY Function Module at batch level?
How to use BAPI_MATERIAL_AVAILABILITY FM to check material available at batch level?
And another question is what's the meaning of 'CHECK_RULE' in this FM. Thanks!Field name : PRREG
fcheck more details on f1 help...
check_group defines the checking procedure to be used for availability check in individual applications.
along with the checkg group, checking rule specifies the final procedure for chkg..
eg:
ST for stock transport order
AQ for SD order project srock
also chk this help doc.
http://help.sap.com/saphelp_470/helpdata/en/cf/70124adf2d11d1b55e0000e82de178/content.htm
search the forum for sample code..
How to use BAPI_MATERIAL_AVAILABILITY Function Module....
Maybe you are looking for
-
Can you set specific viewing options for a pdf linked from the HTMLResouces folder?
Can you change the default view to 2-up facing pages, or open it to a specific page in the pdf?
-
Hello, I am a newbie to GUIs in java. I am writing an application that has 4 buttons. You can run the codes below to see how it looks. I need it to connect to an oracle server when the "Connect to Server" button is clicked If the connection is succes
-
I never liked having the navigation buttons spread across the top. Seems logical and more convenient to have them all in one place. I do not see a way to customize their placement.
-
FONTS problem (new font)
Hello, please can u help me. I have problem with special characters (in czech language) I want to make dynamic TextField with font EMBED. wanna show text: Příliš žluťoučký kůň úpěl ďábelské ódy na měsícPŘÍLIŠ ŽLUŤOUČKÝ KŮŇ ÚPĚL ĎÁBELSKÉ ÓDY NA MĚSÍC
-
Not able to active iCloud mail on mac
I am not able to enable iCloud mail on Mac running Mac OS X lion 10.7.2. When I ticks Emails and Notes in the iCloud setting on my Mac. It says starting for a very long time and then it seem to end okay. But next time I enter the settings again the c