When to use an array of size zero ?
Java provides the facility to have an array of size zero. But I have never seen anybody using this. Do we have any scenario when this zero size array can be used.
Thanks
It allows me to do that, so it perfectly makes sense. Does it makes for you too ?
package unitTesting;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.Collection;
import org.junit.Before;
import org.junit.Test;
public class Rdtf
private Collection<Object> collection;
@Before
public void setUp() {
collection = new ArrayList<Object>();
@Test
public void testEmptyCollection()
assertTrue(collection.isEmpty());
@Test
public void testOneItemCollection()
collection.add("itemA");
assertEquals(1, collection.size());
@Test(expected=IndexOutOfBoundsException.class)
public void testIndexOutOfBoundsException() {
ArrayList<Object> emptyList = new ArrayList<Object>();
Object o = emptyList.get(0);
@Test
public void testIndexOutOfBoundsExceptionNotRaised()
throws IndexOutOfBoundsException {
ArrayList<Object> emptyList = new ArrayList<Object>();
Object o = emptyList.get(0);
}
Similar Messages
-
Why is labview so slow when I use an array subset to scan through a large array
I am using an array sub set to scroll arrays across an intensity graph, and it works but when I load a large array (ex. 482 x 1000) the program is extremely slow, updating appox. every 3 seconds. What I'm I doing wrong?
- there is always an easy way, but it is always the hardest to findCan you attach your code so we can see how you do this?
How big are the subsets you are extracting?
LabVIEW Champion . Do more with less code and in less time . -
Error when using byte array in web service model interface
Hello everybody,
I'm using a web service model in my web dynpro application. The web service requires a byte array as import parameter.
When starting the web dynpro application the following error occurs:
com.sap.tc.webdynpro.services.exceptions.WDTypeNotFoundException: type java:byte not found
at com.sap.tc.webdynpro.services.datatypes.core.DataTypeBroker.getDataType(DataTypeBroker.java:216)
I'm using byte arrays several times in my application --> no problem. So why does the error say "byte not found" when using the web service?
Thanks for your help!
regards
ChristianHi,
maybe this is the problem. The type is byte and not binary.
But I have the same problem as mentioned in the other thread: I can't change the type.
The type in the WSDL of my web service is "base64binary". Is there maybe a possibility to import a jar-file for this type?
Christian -
When i use a print by Wi-Fi is becoming a small, but not on the size of A4
I'm sure that question means something to you, just not to the rest of the English speaking world, even if repeated 3 times.
-
When i use a print by Wi-Fi is becoming a small, but not on the size of A4
When i use a print by Wi-Fi is becoming a small, but not on the size of A4
I'm sure that question means something to you, just not to the rest of the English speaking world, even if repeated 3 times.
-
Array stop work when i use reinit to default
Hi guys,
i'm using a array to save data from my DAQ.. and it saves when some seconds elapsed..
the problem is.. when a i use the invoke node "reinit default" of array after it the array gets empty (ok) but dont get more data (problem)..
please help me!
thanks
Attachments:
labview1.JPG 56 KBhow about adding data flow so your not write to the array and reiniting the array all at the same time. connect your error bundle wires will help control the flow.
richjoh -
FMB size changes when compiled using ifcmp60 compared to using ifbld60
We observed that when we batch compiled our forms size of the FMB reduced quite a bit after batch compile and save compared
to what it was to originally when compiled and saved through forms builder (ifbld60.EXE). If after this form is opened in
forms builder and then compiled and saved it reverts to original size. We also checked using one of the third party form
diff utility and found both FMB’s from batch compile and one from form builder even though of different size do not have any
difference.
Now question sis what is the reason FMB size is reduced and does it not pose any kind of issue for loosing something out of
the FMB. Please explain what is this behavior with impact if any etc?
We batch compile using the following code.
For %%I in (sizechange.FMB) do start /w ifcmp60 module=%%I userid=usrname/passwd@SID batch=yes compile_all=yes Upgrade=No
build=Yes
We made a sample form named sizechange.fmb with non-db block and having program unit selecting from dual multiple times.
Environment details : Windwos 2000, Forms 6.0.8.22.1, db(8.0.6.0.0) on HP9000-UX 10.20
Thanks in advance for your response.
Vinay Gupta
I am not sure where to upload sample file, if someone needs it I can email it.
Thanks,Didn't see they where timestamps . Yes it seems that glx is one cause of the delay. I've tried some different xorg.conf, and it's always ligglx.so or NV-GLX that slows it down. Any suggestions on how I can speed this up?
ps. The computer is ok. Although the garddrive is a SATA 3.0Gb/s, 5400 RPM. But I don't think this is the problem? -
I am using CS6 on a 64 bit PC. When I try to print A4 size layered psd files the program crashes. What can I do to rectify this?
Spoken to IT support who inform me its because files are on network, however they are on my desktop and program is installed on my PC not a network.Other sizes print. Bizarre.
-
I use Adobe Acrobat Pro XI (11.0.08) When performing "Save as" "Reduced file size pdf" Adobe processes for a while then completely stops, and has to close down. Just started doing that today.
I have Windows 8.1, and when I right click on the Windows flag (bottom left), the menu gives me a "Search" option. When I enter "%temp%", it goes to " "my username"/ appdata/temp" which is a list of file 1718 file folders. Many are empty but I did a small sample. Is that the right place to delete? I tried Windows- Disk Clean, but that did not help.
-
I find using the iPhone / iPod size virtual keypad much easier to use with a stylus...as when an iPhone app is installed on the iPad. Anyway to use the iPhone size keypad with all apps?
I don't want the keyboard to become bigger. Wish there was a way to always have the iPhone sized keypad available for use with any app. When typing with fingers or stylus, the distance between keystrokes is SO much shorter and efficent on the iPhone keypad vs the "full size" iPad keyboard.
I've heard that there will be some keyboard options when the new IOS comes out...wish this was one of them.
Haven't looked yet, but is there a place you can recommend things such as this to Apple?
Thanks. -
can you give me a example vi for it ?thanks a lot!
how to auto insert a number array with size of 20 into a named excel file with the positon is from A1 TO A20?i use lv6.1You don't need us to give you an example, as the example already comes with LV. Go to Help>>Find Examples and search for "excel". You will find an example called "write table to XL". You should note that the example doesn't do that exactly, because it writes a 2D array from 2 to N.
You can modify the example by using only one for loop (instead of nested loops) with a 1D array or by going into the Set Cell Value and modifying it to accept a second cell value for the Cell2 terminal and wiring in a 1D array instead of the single string. If you do modify it, be sure to save it under a different name, so you don't overwrite the original.
To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here and here are a couple you can start with. You can also contact your local NI office and join one of their courses.
In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).
Try to take over the world! -
Is normal that appear a spot when i use the camera? and when you apply the zoom, the spot increases its size?
Morning alex navarro,
Thanks for using Apple Support Communities.
For troubleshooting on this, take a look at this article:
iPhone: Hardware troubleshooting
http://support.apple.com/kb/TS2802
Ensure the camera lens is clean and free from any obstructions. Use a microfiber polishing cloth to clean the lens.
Third-party cases can interfere with the autofocus/exposure feature and the flash (iPhone 4 only); try removing the case if you have image-quality issues with photos.
If your iPhone has a front and rear camera, try switching between them to verify if the issue persists on both.
Hope this helps,
Mario -
When I use PSCS5 after having upgraded to Mavericks I have problems when I use the RAW converter. The glider for exposure goes back to sero, hven I use the glider for fill in light, that means that my PSCS5 program not can be used. What do I do?
Single click on the Home button. Then double click on the Home button. In the recently used row, touch and hold the Contact app till they start to wiggle and then tap the minus sing by the contacts app.
Also make sure the Contact program on your computer is closed. -
I am currently storing values from a database into an array
im my servlet. I have a JSP page and I'm trying to set
the datafields on this page to the values held in the array.
I need to send the array from the servlet to the JSP page
and then figure out how I retrieve it at the other end.
Can anyone help????????Here's the code I'm using for my Sevlet:
package SASSSpkg;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.sql.*;
import javax.swing.*;
public class UserLogin extends HttpServlet{
private Connection connection;
private ResultSet resultSet;
private Statement statement;
public String getusername, getpassword, getdatabase;
private String customerId;
private String title;
private String firstName;
private String secondName;
private String surname;
private String residentialAddress;
private String dateOfBirth;
private String correspondenceName;
private String maritalStatus;
private String gender;
private String securityId;
private String postCode;
private String dateOfFirstContact;
private String homeTel;
private String businessTel;
private String currentAddressEntryDate;
private String nationalInsuranceNumber;
private String dateLastUpdated;
public ArrayList values = new ArrayList();
public void init(ServletConfig config) throws ServletException
super.init(config);
public UserLogin()
public void ConnectToDatabase() throws Exception
String url = "jdbc:odbc:SASSS";
String username = getusername;
String password = getpassword;
// Load the driver to allow connection to the database
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
connection = DriverManager.getConnection( url, username,
password);
catch (ClassNotFoundException cnfex)
throw new Exception("cannot connect to database");
catch (SQLException sqlex)
throw new Exception("cannot connect to database");
public void getResultSetData()
try
String query = "SELECT DISTINCT CUSTOMER_ID, TITLE, FORENAME1, FORENAME2, SURNAME, DATE_OF_BIRTH, CUSTOMER_SALUTATN, MARITAL_STATUS, GENDER, SECURITY_NAME, FIRST_CONTACT_DATE,POSTCODE, TELEX, DATE_AT_ADDRESS, NATIONAL_INS_NUM, ADDRESS.LAST_UPDATED, ADDRESS.TELEPHONE FROM CUSTOMER, ADDRESS, CUSTOMER_ADDRESS WHERE CUSTOMER.CUSTOMER_CODE = CUSTOMER_ADDRESS.CUSTOMER_CODE AND CUSTOMER_ADDRESS.ADDRESS_ID = ADDRESS.ADDRESS_ID";
statement = connection.createStatement
(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);
resultSet = statement.executeQuery(query);
resultSet.first();
for (int i = 0; i <= 16; i ++)
values.add(resultSet.getString(i + 1));
statement.close();
catch(SQLException sqlex)
sqlex.printStackTrace();
public void doPost(HttpServletRequest req, HttpServletResponse
res)
throws ServletException, IOException
try{
boolean dbConnection;
// Get username and password from fields on web
page
getusername = req.getParameter("UserName");
getpassword = req.getParameter("Password");
getdatabase = req.getParameter("Database");
PrintWriter output = res.getWriter();
res.setContentType("text/html");
if(getusername.equals("") || getpassword.equals
res.sendRedirect
("http://localhost:9080/SASSS/ErrorPage.jsp");
return;
else
ConnectToDatabase();
getResultSetData();
res.sendRedirect
("http://localhost:9080/SASSS/EmployeeDetails.jsp");
catch(Exception ex) {
res.sendRedirect
("http://localhost:9080/SASSS/ErrorPage.jsp");
public void doGet(HttpServletRequest req, HttpServletResponse
resp)
throws ServletException, IOException
req.setAttribute("myArrayList", values);
public String getCustomerId()
return customerId;
public void setCustomerId(String Id)
customerId = Id;
public String getTitle()
return title;
public void setTitle(String theTitle)
title = theTitle;;
public String getFirstName()
return firstName;
public void setFirstName(String theFirstName)
firstName = theFirstName;
public String getSecondName()
return secondName;
public void setSecondName(String theSecondName)
secondName = theSecondName;
public String getSurname()
return surname;
public void setSurname(String theSurname)
surname = theSurname;
public String getResidentialAddress()
return residentialAddress;
public void setResidentialAddress(String theResidentialAddress)
residentialAddress = theResidentialAddress;
public String getDob()
return dateOfBirth;
public void setDob(String theDOB)
dateOfBirth = theDOB;
public String getCorrespondenceName()
return correspondenceName;
public void setCorrespondenceName(String theCorrespondenceName)
correspondenceName = theCorrespondenceName;
public String getMaritalStatus()
return maritalStatus;
public void setMaritalStatus(String theMaritalStatus)
maritalStatus = theMaritalStatus;
public String getGender()
return gender;
public void setGender(String theGender)
gender = theGender;
public String getSecurityId()
return securityId;
public void setSecurityId(String theSecurityId)
securityId = theSecurityId;
public String getPostCode()
return postCode;
public void setPostCode(String thePostCode)
postCode = thePostCode;
public String getDateOfFirstContact()
return dateOfFirstContact;
public void setDateOfFirstContact(String theDateOfFirstContact)
dateOfFirstContact = theDateOfFirstContact;
public String getHomeTel()
return homeTel;
public void setHomeTel(String theHomeTel)
homeTel = theHomeTel;
public String getBusinessTel()
return businessTel;
public void setBusinessTel(String theBusinessTel)
businessTel = theBusinessTel;
public String getCurrentAddressEntryDate()
return currentAddressEntryDate;
public void setCurrentAddressEntryDate(String
theCurrentAddressEntryDate)
currentAddressEntryDate = theCurrentAddressEntryDate;
public String getNationalInsuranceNumber()
return nationalInsuranceNumber;
public void setNationalInsuranceNumber(String
theNationalInsuranceNumber)
nationalInsuranceNumber = theNationalInsuranceNumber;
public String getDateLastUpdated()
return dateLastUpdated;
public void setDateLastUpdated(String theDateLastUpdated)
dateLastUpdated = theDateLastUpdated;
Here's the code I'm using for my JSP:
<HEAD><SCRIPT type="text/javascript">
<!--
var _sstmrID = null;
var _sstmrON = false;
var _sspos = 80;
function _ScrollStatus(msg, delay)
if (_sstmrON)
window.clearTimeout(_sstmrID);
_sstmrON = false;
var statmsg = "";
if (_sspos >= 0)
for (s = 0; s < _sspos; s++)
statmsg += " ";
statmsg += msg;
else
statmsg = msg.substring(-_sspos, msg.length);
window.status = statmsg;
sspos = (-sspos > msg.length) ? 80 : _sspos - 1;
fname = "_ScrollStatus('" + msg + "', " + delay + ")";
_sstmrID = window.setTimeout(fname, delay);
_sstmrON = true;
//-->
</SCRIPT><SCRIPT type="text/javascript">
<!--
function _ShowObj(lId)
var ob;ob=new Array;
var appVer=parseInt(navigator.appVersion);
var isNC=false,isN6=false,isIE=false;
if (document.all && appVer >= 4) isIE=true; else
if (document.getElementById && appVer > 4) isN6=true; else
if (document.layers && appVer >= 4) isNC=true;
if (isNC)
w_str = "document." + lId;ob[lId] = eval(w_str);
if (!ob[lId]) ob[lId] = _FindHiddenObj(document, lId);
if (ob[lId]) ob[lId].visibility = "show";
if (isN6)
ob[lId] = document.getElementById(lId);
ob[lId].style.visibility = "visible";
if (isIE)
w_str = "document.all.item(\"" + lId + "\").style";ob[lId] = eval(w_str);
ob[lId].visibility = "visible";
function _FindHiddenObj(doc, lId)
for (var i=0; i < doc.layers.length; i++)
var w_str = "doc.layers.document." + lId;
var obj;obj=new Array;
obj[lId] = eval(w_str);
if (!obj[lId]) obj[lId] = _FindHiddenObj(doc.layers[i], lId);
if (obj[lId]) return obj[lId];
return null;
//-->
</SCRIPT></HEAD>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<html:html>
<HEAD>
<%@ page
language="java"
contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"
errorPage="ErrorPage.jsp"
%>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="IBM WebSphere Studio">
<META http-equiv="Content-Style-Type" content="text/css">
<LINK href="style.css" rel="stylesheet" type="text/css">
<h2>
<%@page import="SASSSpkg.UserLogin"%>
<%@page import="java.util.*"%>
<%@page import="javax.servlet.*"%>
<%@page import="javax.servlet.http.*"%>
<% UserLogin ul = new UserLogin(); %>
<TITLE>SASSS Employee Details</TITLE>
</HEAD>
<BODY bgcolor="#c0c0c0"><FORM action="servlet/SASSSpkg.UserLogin" method="get">
<%
if (request.getAttribute("myArrayList") != null) {
ArrayList Alist = (ArrayList)request.getAttribute("myArrayList");
ul.setCustomerId(Alist.get(0).toString());
else {
response.sendRedirect("http://localhost:9080/SASSS/ErrorPage.jsp");
%>
<TABLE border="0" width="792" height="359">
<TBODY>
<TR>
<TD colspan="6" valign="middle" align="center" height="58"><B>Customer
Id</B> <INPUT type="text" name="customerId" size="20" maxlength="10"
disabled value='<%= ul.getCustomerId() %>'></TD>
</TR>
<TR>
<TD align="center" height="57" width="160"><SPAN
style="font-weight: bold"><B>Title</B><BR>
<SELECT name="title" size="1">
<OPTION><%= ul.getTitle()%></OPTION>
<OPTION>Mr</OPTION>
<OPTION>Mrs</OPTION>
<OPTION>Miss</OPTION>
</SELECT></SPAN></TD>
<TD align="left" height="57" width="171"><SPAN
style="font-weight: bold"><B><STRONG>First Name</STRONG></B><BR>
<SCRIPT type="text/javascript">
<!--
_ScrollStatus("How cool is this", 2);
//-->
</SCRIPT><INPUT type="text" name="firstName" size="20" maxlength="25" value = '<%= ul.getFirstName() %>' ></SPAN></TD>
<TD align="left" height="57" colspan="2"><SPAN
style="font-weight: bold"><B>Second Name</B><BR>
<INPUT type="text" name="secondName" size="20" maxlength="25" value='<%= ul.getSecondName() %>'></SPAN></TD>
<TD align="left" height="57" colspan="2"><SPAN
style="font-weight: bold">Surname<BR>
<INPUT type="text" name="surname" size="20" maxlength="25" value='<%= ul.getSurname() %>'> </SPAN></TD>
</TR>
<TR>
<TD colspan="2" align="center" rowspan="3"><B>Residential Address</B><BR>
<TEXTAREA rows="7" cols="31" name="residentialAddress" ><%= ul.getResidentialAddress() %></TEXTAREA></TD>
<TD align="left" height="66" colspan="2"><B>Date of Birth</B><BR>
<INPUT type="text" name="dateOfBirth" size="20" maxlength="10" value='<%= ul.getDob() %>'></TD>
<TD align="left" colspan="2"><B>Correspondence Name<BR>
<INPUT type="text" name="correspondenceName" size="20" maxlength="25" value='<%= ul.getCorrespondenceName() %>'>
</B></TD>
</TR>
<TR>
<TD align="left" height="42" colspan="2"><B>Marital Status </B> <SELECT
name="maritalStatus" style="">
<OPTION selected><%= ul.getMaritalStatus()%></OPTION>
<OPTION>Divorced</OPTION>
<OPTION>Married</OPTION>
<OPTION>Seperated</OPTION>
<OPTION>Single</OPTION>
<OPTION>Widowed</OPTION>
</SELECT></TD>
<TD align="left" colspan="2"><B>Gender</B> <SELECT name="gender">
<OPTION><%= ul.getGender()%></OPTION>
<OPTION>Female</OPTION>
<OPTION>Male</OPTION>
</SELECT></TD>
</TR>
<TR>
<TD colspan="4" height="56"><B>Security
Id </B><INPUT type="text" name="securityId"
size="20" maxlength="20" value='<%= ul.getSecurityId() %>'></TD>
</TR>
<TR>
<TD height="55" align="left" colspan="2" nowrap><B>
Post Code </B> <INPUT type="text"
size="15" maxlength="8" value='<%= ul.getPostCode() %>' name="postCode"></TD>
<TD height="55" align="left" colspan="2"><B>Date of First Contact</B><BR>
<INPUT type="text" name="dateOfFirstContact" size="10" maxlength="10" value='<%= ul.getDateOfFirstContact() %>'>
</TD>
<TD height="55" rowspan="5" align="center" colspan="2"><SELECT
size="9" name="aditionalDetailForms">
<OPTION value="">Products Held</OPTION>
<OPTION>Employment</OPTION>
<OPTION>Dependants</OPTION>
<OPTION>Residential Details</OPTION>
<OPTION>Assets/Liabilities</OPTION>
<OPTION>Income/Commitments</OPTION>
<OPTION>Banks/Building Societies</OPTION>
<OPTION>Credit Cards</OPTION>
<OPTION>Leads and Follow ups</OPTION>
<OPTION value=""></OPTION>
</SELECT></TD>
</TR>
<TR>
<TD height="41" align="left" colspan="2" nowrap><B> Home
Tel </B>
<INPUT type="text" name="homeTel" size="18" maxlength="14" value='<%= ul.getHomeTel() %>'></TD>
<TD height="41" align="left" colspan="2"><INPUT type="button"
name="lastAddress" value="Last Address"></TD>
</TR>
<TR>
<TD height="49" align="left" colspan="2" nowrap><B> Business
Tel </B>
<INPUT type="text" name="businessTel" size="18" maxlength="14" value='<%= ul.getBusinessTel() %>'></TD>
<TD height="49" align="left" valign="bottom" colspan="2"><B>N.I.
Number</B></TD>
</TR>
<TR>
<TD height="42" colspan="2" nowrap><B> Current
Address Entry Date </B> <INPUT
type="text" name="currentAddressEntryDate" size="10" maxlength="10" value='<%= ul.getCurrentAddressEntryDate() %>'></TD>
<TD height="42" colspan="2"><INPUT type="text"
name="nationalInsuranceNumber" size="20" maxlength="9" value='<%= ul.getNationalInsuranceNumber() %>'></TD>
</TR>
<TR>
<TD height="44" colspan="2" nowrap><B> Date Last
Updated </B>
<INPUT type="text" name="dateLastUpdated" size="10" maxlength="15" value='<%= ul.getDateLastUpdated() %>'></TD>
<TD height="44" align="left" colspan="2"><INPUT type="button"
name="directMailExclusions" value="Mail Exclu"> <INPUT
type="button" name="telephoneExclusions" value="Tel Exclu"></TD>
</TR>
<TR>
<TD height="44" align="left" colspan="6" nowrap> <INPUT
type="submit" name="ok" value=" OK "> <INPUT
type="button" name="forward" value=" >> "> <INPUT
type="button" name="exit" value=" Exit "> <INPUT
type="button" name="delete" value=" Delete "> <INPUT
type="reset" name="refresh" value=" Refresh "> <INPUT
type="button" name="help" value=" Help "></TD></TR>
</TABLE></FORM>
</BODY>
</html:html>
The problem is, I'm trying to store String values into an array,
or a result set and then store them in the data fields on my jsp page.
When I use my set method such as setCustomerId(values.get(0));
it sets the variable customerId to the value I want but when I try to
call the get method in the JSP page to assign it to the data field it
will not retrieve it.
Can anyone solve this, I've been at it for days now???? -
Use boolean array to perform set operations
I am currently taking a computer science class that uses Java as the language of choice. I have no prior experience with Java. We have a homework assignment in which we are supposed to use a boolean array to implement set operations. We have to create a method that inserts an integer into the array, another that deletes an integer element, and several others. I am confused as how to do this with integers, as it is a boolean array. The datr for this class is:
private boolean base[];The constructor is:
public largeset(int size){ }We then have to create a method that inserts an integer into the array:
public void insert(int i){ }And one that deletes the element:
public void delete(int i) { }I am unsure how to do this using a boolean array. If it were an integer array I would not have any trouble, but I get an error when trying to insert/delete an integer from the boolean array. Can anyone help point me in the right direction? I would prefer advice only, not the actual code, as this is a homework assignment, and I would like to create the code myself so I actually know what I am doing. Thanks.This is the assignment exactly as posted on the course website:
In this homework, we will use a boolean array to implement various set operations. Please create a class called largeset that supports set operations of any number of elements. The data of this class is
private boolean[] base;The constructor of the class is
public largeset(int size); // create a boolean array of size "size" and store it in "base"The methods of the class are:
public void insert(int i); // insert number i into the current set, where 0 <= i < base.length
public void delete(int i); // delete number i from the current set, where 0 <= i < base.length
public boolean member(int i); // test if i is in the set
public largeset union(largeset B); // return the union of two sets
public largeset interset(largeset B); // return the intersection of two sets
public largeset subtract(largeset B); // return the subtraction of two sets
public largeset complement(); // return the complement of the current set
public boolean subset(largeset B); // test if the current set is a subset of set B
public int cardinality(); // return the number of elements in the current set
public String toString(); // return a string which is a printing of the current setThen create another class called testset that uses the largeset class. At first, please create the following two sets:
X = { 1, 3, 5, 7, ..., 999 };
Y = { 9, 18, 27, 36, ..., 999 };
Please perform the following tests:
1. display the cardinalities of X and Y, respectively.
2. display the content of substraction of Y by X.
3. display the square root of the sum of all the elements of X (Math.sqrt(x) will return the square root of x in double type).
4. For every pair of distinct elements x and y in Y, compute the sum of (Math.max(x, y) - Math.min(x, y)) (or equivalently, Math.abs(x - y)), and report this sum.
Maybe you are looking for
-
when installing iTunes on my new laptop a message box appears saying some sort of error has occured and i have to uninstall it then reinstall it again and it still won't work what should i do?
-
My apple tv is not accepting my apple ID for itunes after an update
Apple tv is not taking my apple ID for itunes, after i updated the apple TV it stopped logging me into itunes, what should i do...?
-
MSVCR80.dll was not found" can anyone help me please?
I have clicked on "update" prompt when I turned on itunes and now I cant use it because there is a message on screen saying " This application has failed to start because MSVCR80.dll was not found. does anybody have any ideas that I can try?
-
"Return" key code (bottom right of keyboard, Director doesn't recognize
Dear All, I am trying to write a script that takes place when a user presses the RETURN key located on the numeric keypad-bottom right corner of the keyboard-but director doesn't seem to acknowledge the key when it is pressed. It doesn't even go into
-
I couldn't see any music on iTunes that I had previously saved. I looked in Previous iTunes library. "Previous iTunes Library" now appears at the top of my iTunes screen, is this the problem? If so how do I fix it so i can access my saved music?Also