Đề Xuất 5/2023 # How To Create Java.util.dictionary Class # Top 11 Like | Beiqthatgioi.com

Đề Xuất 5/2023 # How To Create Java.util.dictionary Class # Top 11 Like

Cập nhật nội dung chi tiết về How To Create Java.util.dictionary Class mới nhất trên website Beiqthatgioi.com. Hy vọng thông tin trong bài viết sẽ đáp ứng được nhu cầu ngoài mong đợi của bạn, chúng tôi sẽ làm việc thường xuyên để cập nhật nội dung mới nhằm giúp bạn nhận được thông tin nhanh chóng và chính xác nhất.

Dictionary in Java is the abstract class that is the parent of any class which uses the key-value pair relationship. In this blog, we will learn more about the Dictionary class in Java and get familiar with the different methods. Below are the topics covered in this blog-

What is Dictionary in Java?

Dictionary is an abstract class representing a key/value storage repository that operates like Map. You can store the value in a Dictionary object and once it is stored, you can retrieve it by using its key.


public abstract class Dictionary extends Object

Dictionary() constructor

Methods of util.Dictionary Class 

Let us have a look at a few different methods of Dictionary Class.

Check the size of the dictionary

size() : java.util.Dictionary.size() returns the number of key-value pairs in the Dictionary

Syntax: public abstract int size()

Add/ put values in dictionary

put(K key, V value) : java.util.Dictionary.put(K key, V value) adds key-value pair to the dictionary

Syntax: public abstract V put(K key, V value)

Return values present in the dictionary

elements() : java.util.Dictionary.elements() returns value representation in dictionary

Syntax: public abstract Enumeration elements()

Get method to fetch the values mapped with the key

get(Object key) : java.util.Dictionary.get(Object key) returns the value that is mapped with the key in the dictionary

Syntax: public abstract V get(Object key)

Check if dictionary is empty

isEmpty() : java.util.Dictionary.isEmpty() checks whether the dictionary is empty or not.

Syntax: public abstract boolean isEmpty()

Return true, if there is no key-value relation in the dictionary; else return false.

Removing key value from dictionary in Java

remove(Object key) : java.util.Dictionary.remove(Object key) removes the key-value pair mapped with the key.

Syntax: public abstract V remove(Object key)

Implementation of Dictionary in Java

import java.util.*; public class My_Class { public static void main(String[] args) { Dictionary edu = new Hashtable(); edu.put("1000", "Edureka"); edu.put("2000", "Platfrom"); for (Enumeration i = edu.elements(); i.hasMoreElements();) { System.out.println("Value in Dictionary : " + i.nextElement()); } System.out.println("nValue at key = 3000 : " + edu.get("2000")); System.out.println("Value at key = 1000 : " + edu.get("2000")); System.out.println("nThere is no key-value pair : " + edu.isEmpty() + "n"); for (Enumeration k = edu.keys(); k.hasMoreElements();) { System.out.println("Keys in Dictionary : " + k.nextElement()); } System.out.println("nRemove : " + edu.remove("1000")); System.out.println("Check the value of removed key : " + edu.get("1000")); System.out.println("nSize of Dictionary : " + edu.size()); } }

How To Create Pivot Chart In Excel?

How to create pivot chart in Excel?

In Excel, you may usually insert a chart to help you analyze the data, but do you know in some cases, a pivot chart is better than the normal chart for analyzing in Excel? Now this tutorial is talking about pivot chart creating in Excel.

Create pivot chart in Excel

Create pivot chart in Excel

To create a pivot chart, you can do as the following steps:

2. In the popping Create PivotTable with PivotChart dialog, choose the location you want to place the new PivotTable and PivotChart in Choose where you want the PivotTable and PivotChart to be placed section. See screenshot:

4. Now drag the fields you want to show in the PivotChart to the areas as you need. Here I drag Saler and Order ID fields to Axis Fields (Categories) section, and drag Amount field to Values section. See screenshots:

Note: When you create a pivot chart, a pivot table is created at the same time.


If you want the legend series shown as Saler, you can drag Saler field to the Legend Fields (Series) section. See screenshots:


(1) The pivot table will change as the pivot chart changes.

(2) In Excel 2007, we cannot filter data in the Pivot chart, but we can filter data in the Pivot table and the data in the pivot chart will change automatically.

Relative Articles:

The Best Office Productivity Tools

Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%


Quickly insert

complex formulas, charts

 and anything that you have used before;

Encrypt Cells

with password;

Create Mailing List

and send emails…

Super Formula Bar

(easily edit multiple lines of text and formula);

Reading Layout

(easily read and edit large numbers of cells);

Paste to Filtered Range

Merge Cells/Rows/Columns

without losing Data; Split Cells Content;

Combine Duplicate Rows/Columns

… Prevent Duplicate Cells;

Compare Ranges

Select Duplicate or Unique


Select Blank Rows

(all cells are empty);

Super Find and Fuzzy Find

in Many Workbooks; Random Select…

Exact Copy

Multiple Cells without changing formula reference;

Auto Create References

to Multiple Sheets;

Insert Bullets

, Check Boxes and more…

Extract Text

, Add Text, Remove by Position,

Remove Space

; Create and Print Paging Subtotals;

Convert Between Cells Content and Comments

Super Filter

(save and apply filter schemes to other sheets);

Advanced Sort

by month/week/day, frequency and more;

Special Filter

by bold, italic…

Combine Workbooks and WorkSheets

; Merge Tables based on key columns;

Split Data into Multiple Sheets


Batch Convert xls, xlsx and PDF

More than 300 powerful features

. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial. 60-day money back guarantee.

Read More… Free Download… Purchase… 

Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

Enable tabbed editing and reading in Word, Excel, PowerPoint

, Publisher, Access, Visio and Project.

Open and create multiple documents in new tabs of the same window, rather than in new windows.

Increases your productivity by

Read More… Free Download… Purchase… 

How To Create Numbered Headings Or Outline Numbering

Quick reference to numbering headings and paragraphs in Word

1 Don’t use the pretty numbering or bullet buttons on the toolbar or the ribbon. They look inviting, but they’re not what you need.

2 Don’t use the toolbar numbering or bullet buttons. They’re not what you need either.

3 Apply styles to your headings, preferably Word’s built-in Heading styles.

4 Modify the styles so you can have the font, paragraph and other formatting to suit your needs.

5 Modify the numbering and indenting by modifying the numbering settings of the Heading styles. The styles will manage the numbering and the indents.

Managing numbered headings and outline numbering in anything but the simplest of Microsoft Word documents can easily drive you crazy. You seem to go round and round in circles, and never end up with what you want. And just when you get close, it falls to pieces.

You are not alone!

This page lays out the basics of how to set up outline numbering in Word. For more details, see the links at the bottom of this page.

The key is to use Styles. Since there are good reasons for using Word’s built-in Heading styles, this page concentrates on using those Heading styles.

How to set up numbering depends on which version of Word you have

How you set up numbered headings depends on what version of Word you have.



Five other things to think about

Once you have your numbering set up the way you want it, there are some other things to think about:

Let’s say you just created a paragraph in Heading 1 style. Now, you press Enter to go on to create the next paragraph. What style will that paragraph be in? You can modify a style to stipulate the style Word uses for the following paragraph. So you could set it up so that, when you’re entering text, a Heading 1 will be followed by a Heading 2. And, you could set it up so that a paragraph in Heading 2 will be followed by a paragraph in style Body Text.

If you need to update the styles in your document from its template, see How to safely update a document’s styles from its template without using the Organizer at the MS Word MVP FAQ site.

Why go to all this bother?

Too good to be true?

Grateful acknowledgement

Almost everything I learned about Word’s numbering I learned from the Word newsgroups (especially the Microsoft Word Numbering newsgroup) and from the MS Word MVP FAQ site. The contributions of John McGhie (especially his article about Word’s Numbering Explained on the MS Word MVP FAQ site) and Dave Rado are significant. The current page represents a mere summary and application of some of that work.

How To Create Macros In Microsoft Word 2022 And 2022?

Applicability: Word 365, 2019, 2016; Windows and MAC OS X operating systems.

Here’s a question from a reader::

Enabling the developer tab in Word

If you don’t see the Developer tab in your Microsoft Word Ribbon, you’ll need to setup your Macro development environment.

Open a new Word document. In case that you would like to work on an existing file, ensure that you have a copy for backup, before making any changes.

Now, go ahead and make the developer menu visible in the Ribbon.

Recording a Word Macro – a practical example

Now, hit the newly added Developer tab.

Go to the Code button group.

Note: Although it’s possible to assign Macros to buttons , for simplicity we’ll run Macro manually via the View tab or Developer tabs.

Execute the sequence of steps you would like to record. In this case, you’ll record the following steps:

Select a specific paragraph in your document.

Go to the Home tab.

Set the font to Times New Roman.

Set the Font Size to 16.

Center your Text by hitting Ctrl +E.

Once Done, return to the Developer tab and hit Stop Recording.

Now let us take a look at the auto-generated VBA code. Hit Macros and then highlight the AutoFormat Macro and hit Edit.

Close the VBA Editor.

Save your work in a Word Macro enabled template

In the Save As dialog right hand side, determine your saving location and provide a meaningful name to your Workbook.

Choose Word Macro Enabled Document as your document type. Note: Your Word document will be saved with the .docm suffix.

Hit the Save Button.

Executing your macro

Open your Word document.

Select the Paragraph you would like to automatically format. Just as an example, here’s the paragraph i chose:

Go to the View tab.

Hit the Macros button.

Select your AutoFormat Macro

Hit Run – this will apply the macro on the selected paragraph.

Assigning your Macro to Buttons or keyboard shortcuts

Note: This is an optional step that should be attempted after you have followed the Macro recording tutorial above.

OK, so far we got our Macro basics working. Now it’s time to improve a bit our Macro usability in the Word doc. Let me show you how you can associate your Macro with a quick access button, so you can launch it more easily.

The Word Options dialog will come up.

In the Choose commands from dropdown, select Macros.

Hit the Modify… button to define a suitable icon for your Macro.

Define a Display name for your button.

Hit OK.

Now, you can launch your Macro from the Quick Access Toolbar, just above the Ribbon.

Note: You are able to associate your Word Macro not only with quick access buttons but also with command buttons embedded in your document and specific custom keyboard shortcuts.

Creating Word Macros using VBA

With some simple Visual Basic for Applications coding skills we can edit the macros and write programs to automate various kinds of works using VBA.

Aside Note: FYI – some of the Microsoft Office applications, such as Powerpoint and Outlook, do not have built in macro recorders. Therefore, writing VBA is mandatory for writing Powerpoint macros and automating Outlook.

The Visual Basic for applications editor will open up.

Let’s assume that we want to manually edit the Macro we have recorded in the previous step, so that Word not only set the Size, font and alignment of the paragraph, but also the color.

Setting the color of a section is achieved using the following VBA command:

[code] Selection.Font.Color [/code]

In our case, we’ll want to set it to a random blue, so we’ll append the following snippet to our Recorded macro:

[code] Selection.Font.Color = 16737792[/code]

Here’s how your VBA code should look like:

In the VBA Editor hit File and then Save.

Back to your document, run your Macro on a paragraph and observe the font color change.

Useful Word Macro example you can write

Since publishing this tutorial, many readers asked for more in depth examples of Word Macros. This list covers the most prevalent tasks you can automate using Visual Basic in Word. Here we go:

Create and Save New Document

Sub CreateNewDoc() 'This small snippet first creates a new document, then it checks whether a document with the same name already exists before saving. Dim myDoc As New Document Dim filePath As String 'Modify your file path as needed filePath = "C:MyNewDoc.docx" Set myDoc = chúng tôi With myDoc If Dir(filePath) = "" Then .SaveAs2 (filePath) Else 'You have already an existing document MsgBox ("Please use a different file name") End If End With myDoc.Close SaveChanges:=wdPromptToSaveChanges End Sub

Open a Word document with VBA

Sub OpenDoc() 'This code checks whether your document exists and then opens it filePath = "C:MyNewDoc.docx" If Dir(filePath) = "" Then MsgBox ("file doesn't exist") Else chúng tôi (filePath) End If End Sub

Closing one/all open documents

Sub CloseDoc() 'This code closes a specific document filePath = "C:MyNewDoc.docx" Documents(filePath).Close SaveChanges:=wdPromptToSaveChanges End Sub Sub CloseAllDocs() 'This code closes all opened documents in your computer Documents.Close SaveChanges:=wdPromptToSaveChanges End Sub

Saving Word as PDF

Here’s how to easily automate saving of Word documents as PDF files.

Sub SaveAsPdf() 'This code saves a word document in a PDF format FileName = Left(CStr(ActiveDocument.Name), Len(CStr(ActiveDocument.Name)) - 5) ActiveDocument.SaveAs2 FileName:="c:" + FileName + ".pdf", FileFormat:=wdFormatPDF End Sub

Inserting header and footer

This code sets the header and footer of your Word document first page.

Sub InsertHeaderFooterFirstPage() Dim myDoc As Document Dim headerText As String Dim footerText As String Set myDoc = ActiveDocument 'Replace the header and footer text as needed headerText = "This document was written by you" footerText = "All rights reserved to you" With myDoc.Sections(1) 'We first ensure that we can set different header and footer texts .PageSetup.DifferentFirstPageHeaderFooter = True 'Setting the header and footer texts .Headers(wdHeaderFooterFirstPage).Range.Text = headerText .Footers(wdHeaderFooterFirstPage).Range.Text = footerText End With End Sub

Additional Word Macro ideas

Here are a few more ideas which we’ll be posting in the upcoming future.

Find and Replace (Execute Method)

Insert a paragraph (before and after a selection)

Printing documents programatically

Working with tables

This concludes our tutorial for today. As you just saw, there is a lot to be done with the Word macro recorder and VBA Macros in Word. In case you are looking for more specific help that goes beyond the scope of this tutorial, kindly contact us via our contact form.

Bạn đang đọc nội dung bài viết How To Create Java.util.dictionary Class trên website Beiqthatgioi.com. Hy vọng một phần nào đó những thông tin mà chúng tôi đã cung cấp là rất hữu ích với bạn. Nếu nội dung bài viết hay, ý nghĩa bạn hãy chia sẻ với bạn bè của mình và luôn theo dõi, ủng hộ chúng tôi để cập nhật những thông tin mới nhất. Chúc bạn một ngày tốt lành!