for (int i= 0; i < nPackageEntries; i++) { PackageEntry pack= (PackageEntry) fPackageEntries.get(i); if (pack.hasStarImport(fImportOnDemandThreshold)) { starImportPackages.add(pack.getName()); } }  evaluateStarImportConflicts(starImportPackages, onDemandConflicts);
	public String getReplaceString(TextBuffer textBuffer, TextRange textRange) throws JavaModelException {		int importsStart=  textRange.getOffset();		int importsLen= textRange.getLength();						String lineDelim= textBuffer.getLineDelimiter();				StringBuffer buf= new StringBuffer();						int nCreated= 0;		PackageEntry lastPackage= null;						HashSet starImportPackages= new HashSet();		HashSet onDemandConflicts= new HashSet();				int nPackageEntries= fPackageEntries.size();		for (int i= 0; i < nPackageEntries; i++) {			PackageEntry pack= (PackageEntry) fPackageEntries.get(i);			if (pack.hasStarImport(fImportOnDemandThreshold)) {				starImportPackages.add(pack.getName());			}		}				evaluateStarImportConflicts(starImportPackages, onDemandConflicts);				for (int i= 0; i < nPackageEntries; i++) {			PackageEntry pack= (PackageEntry) fPackageEntries.get(i);			int nImports= pack.getNumberOfImports();			if (nImports == 0 || fFilterImplicitImports && isImplicitImport(pack.getName(), fCompilationUnit)) {				continue;			}						// add a space between two different groups by looking at the two adjacent imports			if (lastPackage != null && !pack.isComment() && pack.getGroupID() != lastPackage.getGroupID()) {				ImportDeclEntry last= lastPackage.getImportAt(lastPackage.getNumberOfImports() - 1);				ImportDeclEntry first= pack.getImportAt(0);				if (!lastPackage.isComment() && (last.isNew() || first.isNew())) {					buf.append(lineDelim);				}			}			lastPackage= pack;						boolean doStarImport= starImportPackages.contains(pack.getName());			if (doStarImport && (!fRestoreExistingImports || pack.find("*") == null)) { //$NON-NLS-1$				String starImportString= pack.getName() + ".*"; //$NON-NLS-1$				appendImportToBuffer(buf, starImportString, lineDelim);				nCreated++;			}						for (int k= 0; k < nImports; k++) {				ImportDeclEntry currDecl= pack.getImportAt(k);				String content= currDecl.getContent();								if (content == null) { // new entry					if (!doStarImport || currDecl.isOnDemand() || onDemandConflicts.contains(currDecl.getSimpleName())) {						appendImportToBuffer(buf, currDecl.getElementName(), lineDelim);						nCreated++;					}				} else {					buf.append(content);				}			}		}				if (importsLen == 0 && nCreated > 0) { // new import container			if (fCompilationUnit.getPackageDeclarations().length > 0) { // package statement				buf.insert(0, lineDelim);			}			// check if a space between import and first type is needed			IType[] types= fCompilationUnit.getTypes();			if (types.length > 0) {				if (types[0].getSourceRange().getOffset() == importsStart) {					buf.append(lineDelim);				}			}		}		fNumberOfImportsCreated= nCreated;				String newContent= buf.toString();		if (hasChanged(textBuffer, importsStart, importsLen, newContent)) {			return newContent;		}		return null;	}